Useful Linux Terminal Commands for Beginners

Posted on: 7 April 2016

Terminal emulators are powerful tools in Linux-based operating systems, but they are also one of the most daunting parts of Linux for newcomers to learn. This article will help smooth your transition to Linux with a few terminal commands that are useful and simple to use.

Navigating With cd, ls, and pwd

Before you can begin to use the Linux terminal effectively, you first need to know how to keep from getting lost in your computer's file system. The pwd and ls commands are essential tools for getting information about the current directory, or folder, your terminal is working in.

The pwd command stands for "print working directory." Typing pwd into your terminal will return the full path name of the current folder, starting from the root directory which is indicated by an "/." For example, if you enter the pwd command while your terminal is in your home directory, you will likely see output similar to this:


The words and underscore your_username will be replaced with your actual username, which is also the name of your home folder.

After using pwd to determine where you are, the next logical step is to determine where to go next. The ls command will print all of the files and folders inside your current working directory. If you type ls -a, the output will also show hidden files and folders inside the working directory, each beginning with a "." character (like .hidden_folder). The ls command can be used to return the contents of folders outside of your working directory by typing ls /path/folder_to_search.

Once you have found your bearings with pwd and ls (or at any time if you know where you are!), you can "change directory" with cd /folder_path/folder_name to point your terminal to any folder on your file system.

Manipulating Files and Folders with mkdir, cp, mv, and rm

File and folder manipulation is a very common function of the Linux terminal. A few basic commands can perform manipulations, such as copying, moving, renaming, and deleting much faster than the GUI interface. Here are a few examples; remember that phrases such as folder_name, file_name, and new_path are just descriptive placeholders and should be replaced with the names of real files or folders on your system.

  • Create a new folder inside your current working directory: mkdir folder_name

  • Create a new folder outside of the working directory: mkdir /folder_path/folder_name

  • Copy a file or folder: cp /original_path/original_name /copy_path/copy_name

  • Move a file or folder: mv /path/name /new_path

  • Rename a file or folder: mv /same_path!!/original_name /same_path!!/new_name

  • Delete a file: rm /file_path/file_name

  • Delete a folder: rm -r /folder_path/folder_name

Getting Root Privilege with sudo

Unlike Windows operating systems that have user accounts that are either administrators or standard users, Linux uses a root permissions system for administration. This means that you will need to have root privilege to perform functions on system files and on folders and files that are not owned by your user account.

Root permission is obtained in a Linux terminal by using the sudo ("superuser do") command. For example, if you want to copy a folder that you don't own you must preface the cp command with sudo:

       sudo cp /original_path/original_name /copy_path/copy_name

When you run a sudo command, you will be prompted for your system's root-level password. Many popular Linux distributions allow you to set a root-level password during installation.

It is important to understand that there are no restrictions on what you can do to your system with a terminal that has root privileges. Be cautious when using sudo to avoid losing personal data or preventing your system from booting by modifying system files. The most common use of sudo for beginners is gaining root privilege to install software with a command-line package manager, such as APT on Debian-based systems.

As this guide shows, using the Linux terminal isn't as complicated as it may seem. Learning to perform basic file manipulation is the first step toward unlocking the true power of the Linux terminal! To learn more about this topic, speak with a representative from a company like WAVELINK.