Linux Basic Commands

Managing yourself on the command line is essential to survive the administration of linux servers, that is why I am going to show you 12 commands that you must learn Today!


1- man command

Most Linux commands come together with man pages. A man or manual page, this documentation explains what the command does, examples of how you run the command, and what arguments it accepts.



man command_name

man cat

To navigate the man pages, use the Arrow, Page Up, and Page Down keys. You can also press the Enter key to move one line at a time, the Space bar to move to the next screen, and the b key to go one screen back. To exit the man page, press the q key/

Navigating the File System

In Linux, every file and directory is under the root directory, the first or top-most directory in the directory tree. The root directory is referred to by a single leading slash /.

When navigating the file system on operating on files, you can use either the absolute or the relative path to the resource.

The absolute or full path starts from the system root /, and the relative path starts from your current directory.

2- pwd command

Show the directory the user is currently working.



# pwd


3- cd command

To navigate through the Linux files and directories, use the cd command. It requires either the full path or the name of the directory, depending on the current working directory that you’re in.

Let’s say you’re in /home/teknixx/Documents and you want to go to Photos, a subdirectory of Documents. To do so, simply type the following command: cd Photos (relative path).

├── Home

│   ├── teknixx

│   │   ├── Documents (cd Photos)

│   │   │   └── Photos

Another scenario is if you want to switch to a completely new directory, for example, /home/nagsis/Documents/Movies. In this case, you have to type cd followed by the directory’s absolute path: cd /home/nagsis/Documents/Movies

├── Home

│   ├── teknixx

│   │   ├── Documents 

│   │   │   └── Photos (cd /home/nagsis/Documents/Movies)

│   ├── nagsis

│   │   ├── Documents 

│   │   │   └── Movies

There are some shortcuts to help you navigate quickly:

  • cd .. (with two dots) to move one directory up
  • cd to go straight to the home folder
  • cd – (with a hyphen) to return previous directory
Linux’s shell is case sensitive. So, you have to type the name’s directory exactly as it is.

4. ls command

The ls command is used to view the contents of a directory. By default, this command will display the contents of your current working directory.

If you want to see the content of other directories, type ls and then the directory’s path. For example, enter ls /home/teknixx/Documents to view the content of Documents.

ls -R

ls -a

ls -lha

will list all the files in the sub-directories as well

will show the hidden files

will list the files and directories with detailed information like the permissions, size, owner, etc.

5- mkdir command

The mkdir command  create a folder or a directory. For example, if you want to make a directory called “DIY”, then you can type mkdir DIY. If you want to create a directory named “DIY Hacking”, then you can type mkdir DIY\ Hacking

6- cat command

cat (short for concatenate) is one of the most frequently used commands in Linux. It is used to list the contents of a file on the standard output (sdout). To run this command, type cat followed by the file’s name and its extension. For instance: cat file.txt.

Cat command

Here are other ways to use the cat command:

  • cat > filename creates a new file
  • cat filename1 filename2>filename3 joins two files (1 and 2) and stores the output of them in a new file (3)
  • to convert a file to upper or lower case use, cat filename | tr a-z A-Z > output.txt

7- rm command

The rm command delete files and directories. 

rm -r


Delete just the directory

Deletes both the folder and the files it contains

8- touch command

The touch command allows you to create a blank new file, it can be anything, from an empty txt file to an empty zip file As an example, enter touch /home/teknixx/Documents/Web.html to create an HTML file entitled Web under the Documents directory.

9- cp command

Use the cp command to copy files through the command line. It takes two arguments: The first is the location of the file to be copied, the second is where to copy. For instance, the command cp photo.jpg /home/teknixx/Pictures would create a copy of photo.jpg (from your current directory) into the Pictures directory.

10- mv command

The primary use of the mv command is to move files, although it can also be used to rename files. For example, if we want to rename the file “text” to “new”, we can use mv text(old name) new(new name). It takes the two arguments, just like the cp command.

Move file

Rename file

mv file.txt /home/teknixx/Documents

mv oldname.ext newname.ext

11- sudo command

sudo stands for “SuperUser Do”. So, if you want any command to be done with administrative or root privileges, you can use the sudo command. For example, if you want to edit a file, which needs root permissions, you can use the command – sudo vim file.conf

sudo command


We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things:

      #1) Respect the privacy of others.
      #2) Think before you type.
      #3) With great power comes great responsibility.

root’s password:

12- history command

When you’ve been using Linux for a certain period of time, you’ll quickly notice that you can run hundreds of commands every day. As such, running history command is particularly useful if you want to review the commands you’ve entered before.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *