linux

What is Linux

Linux is an operating system created by Linus Torvalds. It’s a free and open-source that powers about 80% of the servers. There are several distribution of the Linux OS as there are different distribution of the Windows OS, some distributions are;

  • Ubuntu (Kinda the popular one)
  • Debian
  • Fedora
  • Kali Linux (Used by Cyber-Security analyst mostly for Penetration Testing)

These different distros are all Linux distribution, just that it’s has been modified by adding more applications and performance to execute specific functions. When a computer is not running a windows OS, there’s a 80% probability it is running one of the Linux distribution. Also, with the help of Virtual Machine (Virtualization), a computer running windows OS can still run any Linux distro.

The Linux Shell or Terminal

The terminal is an Command Line Interface (CLI) that receives commands as user input and pass it on to the OS for processing. All distros of the Linux OS comes as a Graphical User Interface (GUI). In this tutorial, we will be discussing some basic/popular/useful shell commands and their functions. Below is what Linux CLI look like. terminal

To execute commands on the Linux CLI, it has to be typed in lower case. In rare instance do you have to type in upper case to execute a command. If you need to know more about the commands we will be talking about today, you can use the manual page or the help page of each command. To access the manual page of any command just type

man commandName

ls

And to access the help page of any command, just type

commandName -- help

ls

Without wasting any time, the first command we would look at is the ls.

  • ls (list), is a command used to list the content of present directory/folder you are in. To use the ls command just type
ls

ls

However it can be combined with different arguments such as

ls -l ( to list all properties, including permissions of folders In a directory )

ls

ls -a ( to list all hidden file/folders)

ls

ls * ( to list all folders and subfolders)

ls

ls -r ( to list all files in reverse order)

ls

ls -l

ls

ls ~ (to list all file in the home directory)

ls

  • cd (change directory), is used in the Linux CLI to change your current directory (folder/sub folders ) into another directory, as long as you have access to the directory. You can also change directory into another completely different directory as long as you know the full path to it. To picture this; on your home screen, you have different folders; such as Documents, Downloads, Desktop and so on. If you wish see what’s inside the Desktop folder, you double click it. This is basically what the cd is doing, however through the CLI. To use the cd command just type
cd file path

ls

cd folder-name

ls

cd .. ( to go back one step at your current directory)

ls

cd ~ ( to go back to the head folder of the directory your are)

ls

  • rm (remove), is a Linux command used to delete files/folder. To use the rm command just type
rm filename

ls

and to remove a folder just type

rm -R folder-name

ls

  • cp (copy), is a Linux command used to copy a file/folder from a location to another location To use the cp command just type
cp filename /destination_directory

ls

and to copy a folder

cp -R filename /destination_directory

ls

  • mv (move), command can be used to move and rename a file . To use the mv command type
mv filename /destination_directory

ls

and to rename a file type

mv filename newfilename

ls

  • nano is a Linux command that act as an text editor in the CLI. nano command can be used to view,edit and create a new file. To view/edit a file type
nano filename

ls

and to create file that doesn’t exit yet type

nano filename

ls

  • touch is a Linux command used to create a new file . To use the touch command type
touch filename

ls

  • mkdir (make directory), is a command used to create folders in Linux terminal . To use the mkdir command, type
mkdir foldername

ls

  • clear is a Linux command used to clear the screen Linux terminal. To use the clear command, type
clear

ls

  • history, is a Linux command used to list all the command you’ve executed in the past To use the history command, type
history

ls

  • pwd (print working directory), is a command used to display the path to the current directory you are working on. The pwd will display the current directory you are working on. To use the pwd command, type
pwd

ls