This article presents a condensed list of the most used Linux commands for beginners and their practical applications for everyday uses. Every command comes with examples to help understand their application.

Linux may seem intimidating at first, as many think only knowledgeable IT Professionals can work with it to solve daily problems. But with a comprehensive list of Linux commands, you will be ready to deal with this powerful operating system’s basic operations.

As a new user, you won’t know all commands by heart, and you don’t need to. This small subset of commands will be enough to get started. We will also include a list of these Linux commands for beginners on a pdf cheat sheet at the end of the article for an easy way to check on them when needed.

List of Linux Basic Commands for Beginners

1. The ls command

The ls command – Lists the content of the current working directory. For a more organized output of larger directories, use ls -l.

Use ls followed by a directory to view the contents of a directory. For example, type ls /home/username/Desktop to visualize the Desktop directory’s contents. Meanwhile, ls /home/username/Desktop -l | more produces a paginated version of the command, helpful when dealing with many files. Using ls -a will also display hidden files. Files shown in blue represent folders, while white represents files. Different Linux distros will have different color schemes for this.

The information ls /home/username/Desktop -l | more outputs help when dealing with larger directories. It lists the files in a page-by-page format. You can stop the page navigation earlier by using Ctrl-C.

2. The pwd command

The pwd command – Prints the current working directory path in the console. Especially useful when deep in the filesystem and figuring out the current path is required.

3. The mkdir command

The mkdir command – Creates a directory. To create a directory named Work, for example, type mkdir Work into the terminal.

Create additional directories inside it by typing it with a forward slash, such as mkdir Work/Images

4. The mv command

The mv command – It moves or renames files. To rename, type mv one.txt two.txt. Use the ls command to check if the files were moved or renamed. Type mv followed by the name of the file and the destination to move a file. It’s essential to be in the right directory to use the mv command correctly. In this example, we are moving a file from the Desktop to the user directory. Typing mv file.txt /home/username has the same effect.

5. The cat command

The cat command – Primarily prints a file’s content to the terminal. Type cat test-file.txt to print a single file or cat test-file-one.txt test-file-two.txt test-file-three.txt to print multiple files.

It can also create files by typing cat > filename or link files with cat fileone filetwo>filethree

6. The cp command 

The cp command – Copies files from the current directory to a different one. Typing cp project.txt/home/username/Desktop/work creates a copy of the project.txt file into the work directory inside the desktop. 

Add -r after the command to copy the whole directory and its files.

7. The touch command 

The touch command – Creates new blank files of any format. Type touch /home/username/Desktop/file.txt to create a new empty text file on the desktop. This command allows creating empty files of any extension like zip, txt, HTML, and many others.

8. The cd command

The cd command – Goes to the specified directory. Use it together with either the directory name or the absolute path. The usage will vary depending on the current path within the file system. For instance, typing cd Music goes to the Music directory. Be careful, as the command is case sensitive. 

If the directory has spaces in its name, surround the directory name with quotes or use backslash before the space for the terminal to acknowledge the directory. Use cd “School Homework” or cd School\ Homework to access a directory with a space on it. Avoid having to do this by not using names with spaces, and instead, use names such as School-Homework or School_Homework.

Move up a directory by typing cd .. or move back to the home directory with cd ~.

Pressing TAB will attempt to “autocomplete” the current command. For example, cd Desk will become cd Desktop when pressing TAB.

9. The sudo command 

The sudo command – Short for “SuperUserDo.” It runs other commands with administrative or root privileges. When using multiple commands that require root privileges, use sudo -i then type the password to start the shell as root.

Using root privileges should be done with extra care. Mistakes with root access are hard to undo.

10. The rm command 

The rm command – Deletes directories, their contents, or specific files. Use this command by typing rm filename to remove the file. Remove a directory and all listed directories and files within by using -r to remove them recursively.

This command doesn’t ask for confirmations and will instantly remove the files when executed. These files won’t be in the bin, and recovery is difficult. If the files or directories need to be permanently removed with no recovery, use the command shred.

Use the rmdir command to delete empty directories. Remove multiple directories by typing rmdir directory1 directory2 directory3 provided that the directory is empty. If there are files within, use the rm command with the -rf option instead, like rm -rf directory1 directory2.

Bonus Tips

  1. When using any of the commands that deal with the file system, use ls -l to update the terminal and check if all the changes are in effect.
  2. Quickly empty the terminal by using the command clear. Useful after using multiple commands.
  3. Using the exit command leaves the terminal.
  4. Move to the beginning of a line by pressing Ctrl+A or the end by using Ctrl+E. The Home and End key also have the same effect.
  5. Press the Up Arrow to cycle throughout the last used commands.
 

Linux Basic Commands for Beginners – Cheat Sheet Download

You can download a cheat summary of the article from this link.

 

Further Reading

We suggest the following articles for further reading.
 

Conclusion – Linux Basic Commands for Beginners

Hopefully, these basic Linux commands will help you navigate, use Linux, and learn about its remarkable capabilities and incredible flexibility. There’s a vast array of intermediate and advanced commands to learn still. If you wish to learn more about them, please let us know in the comments below!

If you would like to have a printer-friendly list of the most useful Linux commands, we offer a simplified free PDF cheat sheet by clicking here.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.