Basic Linux Commands

Basic Linux Commands

We’ll show you 10 basic Linux commands. This article explains some of the most used Linux commands and their basic usage. All these commands should be entered at the command prompt and you must press the ENTER button to execute the desired command. Please note that all Linux commands are case sensitive.

1. Cat Linux Command

cat – Shows the contents of files to the screen.

# cat file.txt
# Hello World

Also this command can be used to count the number of lines, words and characters in a file:

cat  | wc -l

– number of lines

cat  | wc -w

– number of words

cat  | wc -c

– number of characters
To search for a word in a file you can use:

# cat  | grep <some word>

2. CD Linux Command

cd – Change directory
the ‘cd’ command should be used followed by the name of a directory including the full path to that directory. If you execute ‘cd’ without arguments the working directory will be switched to your ‘home directory’.

# cd /path/to/directory_name/

To move one directory up, you can use the shortcut command:

# cd ..

3. CP Linux Command

cp – Copy files and directories



# cp /root/file /tmp/

With this command you will make a copy of ‘file’ located in the ‘/root’ directory to the ‘/tmp’ directory if it does not exist. It will overwrite it in case the ‘file’ already exists.

4. DP Linux Command

df – Check the amount of free disk space on the filesystems.

# df

To get a more easily readable (human-readable) output of the command use:

# df -h

5. Free Linux Command

free – Gives information about used and free memory and swap space on a Linux machine.

# free

The -b option shows the amount of memory in bytes; the -k option (set by default) shows it in kilobytes; the -m options shows it in megabytes.

6. RM Linux Command

rm – Removes directories, files, symbolic links, etc. from the filesystem.

# rm <OPTION> <FILE>

Most common options for this command are:
-f : ignore nonexistent files, never prompt
-r : remove directories and their contents recursively
-v : explain what is being removed
Note: Always double check before removing any file or directory.

7. LS Linux Command

ls – Displays a list of files and directories in a specific directory.
If you enter just ‘ls’ without specifying a directory, it will display a list of files and directories in the working directory.

# ls

Most common options for this command are:
-a : shows all files and folders including the hidden ones.
-l : use a long listing format

8. MV Linux Command

mv – Moves files and directories from one directory to another or renames a file or directory.
Move ‘file’ from ‘/root’ to ‘/tmp’ directory

# mv /root/file /tmp/

Rename ‘file1’ to ‘file2’

# mv file1 file2

9. Passwd Linux Command

passwd – change user password

# passwd <USERNAME>

If you execute just ‘passwd’ without specifying the username, you will change your root password.
Note: Never use passwords that are easily guessable, such as passwords based upon names, street addresses, dictionary words, significant dates, etc… A strong password consists of a combination of letters (both upper and lower case), numbers and special characters and it should be at least 8 characters long.

10. Mkdir Linux Command

mkdir – Creates directory(ies) if they don’t already exist



# mkdir /var/www/<NEW_DIRECTORY>

Basic Linux CommandsOf course you don’t have to know Basic Linux Commands, if you use one of our Managed Ubuntu VPS hosting plans in which case you can simply ask our expert Linux admins to explain some Basic Linux Commands for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post, about the Basic Linux Commands, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

5 thoughts on “Basic Linux Commands”

Leave a Comment

To prove you are human please solve the following *