Linux Command Line Basics

Linux command line basics

Linux Command Line Basics

Here are the basic commands that you should become familiar with when learning about the command line in Linux. One thing to remember is that Linux is case sensitive. That means if you type in “cd Movies” and the file is called “movies” you won’t find it.

Command Line basics will help you navigate through the essential commands to get around in the Linux command line. You can read the man pages online here.

1. pwd

Use the “pwd” command to find out the path of the current working directory (folder) you’re in. The command will return an absolute (full) path, which is basically a path of all the directories that starts with a forward slash (/).

2. cd

Use the cd command to go to a directory.

  • cd ~/Movies              Will Bring you to the Movies file
  • cd                                   to go straight to the home folder
  • cd ..                                 Move up one directory
  • cd-                                   to move to your previous directory

3. ls

Use the ls command to know what files are in the directory you are in. You can use “ls -a” to show hidden files.

  • ls -R                            will list all the files in the sub-directories as well
  • ls -a                             will show the hidden files
  • ls -al                           will list the files and directories with detailed information

4. mkdir

Use the “mkdir command when you need to create a folder or a directory.

  • mkdir Music/Newfile

5. rmdir

Use “rmdir” to delete an empty directory.

  • rmdir Oldfile

6. rm

Use “rm” to delete a directory with files in it.

  • rm filename

7. touch

Thetouch command is used to create a file.

  • touch newfile.txt

8. man

To know more about a command and how to use it, use the “man” command. It shows the manual pages of the command. More on man files and how to read them.

9. cp

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 it will be copied to.

10. mv

Use the “mv” command to move files through the command line. We can also use the “mv” command to rename a file.

11. locate

The “locate” command is used to locate a file in a Linux system. Read Finding things in Linux.

12. cat

Use the “cat” command to display the contents of a file.

  • cat file.txt

13. find

Similar to the “locate” command, using “find” also searches for files and directories. The difference is, you use the “find” command to locate files within a given directory.  Read Finding things in Linux.

14. sudo

The “sudo” command enables you to perform tasks that require administrative or root permissions. You can find out more about sudo here.

15. chmod

chmod” is another Linux command, used to change the read, write, and execute permissions of files and directories. You can find more information on file permissions here.


These are just some of the commands in Linux to get you started on your journey. Play around with the commands and read the Man pages to get more information.


How useful was this post?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 1

No votes so far! Be the first to rate this post.

Leave a Reply

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

Updated on April 08, 2022