Skip to content

Linux command line for beginners (Part 1)

First of all.. You are awesome! You probably chose Linux on your own or someone talked you into using it, but let me tell you, it was an excellent choice and I hope you enjoy using it.

If you are new to Linux, you have to know that a lot of configuration can and should be done through a terminal. On most modern Linux distributions like Ubuntu, Mint or Debian you can avoid to use any command line program at all, but more often than not you will find solutions on the Internet that should what to type into the console to fix a problem.

Here are a few commands you should learn to get comfortable with the terminal without breaking things or damaging your computer.

This guide is separated into 3 parts for easier reading.

Part 1: Files and directories

Part 2: System information

Part 3: Network

So, fire up your terminal (start with a mouse click or press Ctrl-Alt-T to open a terminal window) and just follow this guide.

1. Files and directories

1.1. Show files: ls



in the terminal and press Enter. You can see the files of your current folder you are in. If you want to also see hidden files, type:

ls -a

If you want a more detailed list with file sizes and date, you can enter

ls -l

to show more information about the files.

1.2 Change directory: cd

When you run the terminal, you usually start in the home/user folder. You can check in which folder you are by entering


and pressing Enter. When you want to change the folder, enter the command followed by the name of the folder.

cd Desktop

For changing into the folder before the current folder, enter

cd ../

Pro tip: You can always press Tab to let the terminal select and complete your commands with the current files in the folder. Type cd and press Tab to see the effect!


1.3 Copy file: cp

To copy a file, get to the folder where the file ‘myfile.txt’ is located and enter

cp myfile.txt newfile.txt

With this, myfile.txt is copied to newfile.txt. If you want to copy folders, use

cp -r myfolder mycopies/myfoldercopy

The parameter -r means recursive, so all files in the folder get copied, too.

Pro tip: You can use so-called wildcards (*) to copy more files with one command:

cp my*.txt /Textfiles

In this example, all files starting with ‘my’ and ending with ‘.txt are copied to the folder /Textfiles.


1.4 Move files: mv

The move command is similar to the copy command and can be used in the same way.

mv myfile.txt newfile.txt


1.5 Create and update file: touch

This is one of my favorite commands. Use touch to create files, if they not exist.

touch newfile.txt

If the file already exists, it will update the file’s timestamp.


1.6 Create folder: mkdir

This command stand for ‘make directory’ and does exactly what it promises:

mkdir thefolder

It creates a new folder in the current folder.

Pro tip: You can create more than one folder in a run by typing:

mkdir thefolder folder2 folder3 folder4

This creates 4 folders.


1.7 Delete files and folders: rm

This command is used to delete files.

rm newfile.txt

You have to be careful with this one, because you can not revert the changes and the files you delete will be deleted permanently.

To delete a folder, use:

rm -r thefolder

Remember the -r when copying folders? It also means recursive, so to delete a folder, you obviously have to delete all the files in the folder.

This was Part 1 of the series “Linux command line for beginners”. The next parts will follow soon! Stay tuned!

Published inTechnology

Be First to Comment

Leave a Reply

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