Blog Contents

Linux Basic Commands

Knowledge in Linux is a must for the student, technical professionals, fresher, or job seekers. If you want to have an understanding of following us here, you will get complete information about Linux internals and device driver. If you have any query you reach our embedded systems training in Bangalore / +91 8951422196.


1. passwd(password)
2. man(manual page)
3. ls(list of folders)
4. cd(change directory)
5. mkdir(make directory)
6. rmdir and rm(remove directory and remove folder)
7. cat and cp(concatenation and copy)
8. touch
9. more and less
10. mv(move)
11. head and tail
12. find
13. Some basic important commands

1. passwd

Description: Changes your current password, just give the above command without any arguments in the Linux terminal.
Example: The password that we entered is appeared to be hidden.

2. man

Description: man command in Linux used to display the user manual of any command that we can run on the terminal. It provides a detailed view of the commands which include name, synopsis, options, description, etc.
Example: man =gives a detailed description of how to use man command.

Press enter the command to move page downwards and press ‘q’ to quit or exit from the manual command.
Similarly, man ls =gives the details about the ls command. man passwd-gives=gives the details about the passwd command.

3. ls

Syntax: ls option(s) file/folder
Description: This command will give the list of files and directories.
Example: ls –l =it will show the files in a long list format.

basic commands of linux

ls –a= it will show the files along with the hidden files, generally hidden files start with a dot(.)
In the below figure, the highlighted file is hidden files starting with dot.

linux basic commands with examples

Similarly, some examples of ls commands are,

ls –lh=shows the long list of files/folders in a human-readable format with approximate size.
ls –l ~=shows the folders of home(~tilt symbol represents home directory).

4. cd(change directory)

Description: It changes the current working directory, used to move around in the hierarchy of your file system.
Example: cd ~=it comes to our systems home directory.

linux basic commands

cd. =single dot followed by cd will represent the current working directory.
cd..=double dot followed by cd will represent the back/previous directory.
for the below picture my current directory is sul and the previous directory is Desktop.

linux basic commands for beginners

5. mkdir(make directory)

Description: Create one or multiple directories if they don’t exist.
Example: Create a file name called new_file inside downloads and check with ls, after that create two files inside the download folder and check with ls.

basic commands of linux

6. rmdir and rm(remove/delete directory and remove)


Description: This command removes each directory specified on the command line, if they are empty, that is each directory removed must contain no files or directories.
Example: If any folder contains inside the directory then the above command doesn’t work. this is shown in the below picture. Inside new2 folder, another folder is there that is new_1, therefore, rmdir new2 won’t work.

basic commands of linux


Description: This command removes/delete each file specified on the command line. by default, it doesn’t remove directories.
rm –r file_name = delete the files and folders recursively from the lower hierarchy.
rm –rv file_name = v is verbose it will show that what is happening and which file we are deleting.

basic linux commands for freshers

rm –fr = here f specifies the forceful deletion(in case of binary file recursively deletion to avoid giving option yes or no while each deletion function.

7. cat(concatenate files) and cp(copy)

a) cat

Description: It can read and concatenate files, writing their contents to the standard output. cat is most commonly used to display the contents of one or multiple text files, combine files by appending the contents of one file to the end of another file, and create new files.

b) cp

Description: This is used to copy the contents of one file to other files. general syntax: cp source destination
Example: cp myfile.txt myfile_copy.txt
Here below figure just shows the usage of cat and cp commands along with some examples.

basic commands of linux

The above picture contains the following steps

  • Here we are creating the one directory name called name test1 in-home directory.
  • Inside the test1 directory, we are creating the two files named old and new.
  • Inside the old directory, we are creating one text file using a touch command named exx in my picture
  • cat file_name.txt=displays the contents in that file.
  • cat > file_name.txt=we can able to write the contents.
  • After writing the contents (ex after hello world) use ctrl+d is end the writing.
  • Again display the file contents using cat < file_name.txt or cat file_name.txt
  • If we again want to write some content and display then previous content will be lost for example (our case hello world will be lost)
  • So we want to keep the previous data also means we need to give cat >> file_name.txt . then give cat file_name.txt then it will display along with the previous contents.
  • If we want to copy the file exx.txt from the old folder to the new folder, then use cp exx.txt ../new/. afterward, check using ls command.

8. touch

Description: Touch command in Linux is used for changing file timestamps if the file exists otherwise creating a new empty file. With the touch command, you can change access, modify and change the time of files and folders in Linux. You can update the timestamps or modify them to a date in the past.

9. more and less

a) more

Description: This command view files or other output in a scrollable manner. it displays the text one screenful at a time and lets you scroll backward and forwards.


Description: It automatically adjusts with the width and height of the terminal window, while ‘more’ command cuts the content as the width of the terminal window gets shorter.

linux basic commands

After giving the more command it will show 15% of the total number of files and appears until 100%.

10. mv(move command)

Description: mv is used to move one or more files or directories from one place to another in the file system like LINUX. It has two distinct functions: (i) It renames a file or folder. (ii) It moves a group of files to a different directory.
General syntax: mv source_file destination_file
Example: The exx.txt from old is copied into the new folder under the test1 folder. as given in the below figure.

basic commands of linux

11. head and tail

Description: The head will display the starting n number of files in the given folder. n number will optional we can give n number, similarly, the tail will display the n number of files at the end of the folder.
Example: head -5 new.txt= displays the 5 number of lines at the start. less -5 new.txt= displays the 5 number of lines at the end.

12. find(to search file or where we want to go)

Description: It searches one or more directory trees of a file system.
Example: find ~ -name “file_name.filetype” = it will show our file name located in which directory.

13. Some Basic Important Commands in Linux

wc –l new.txt = it shows many lines present in that file.
wc –w new.txt = shows the number of words present in that file.
wc –c new.txt = shows the number of characters present in that file.
exit = exit from the terminal.
clear = clearing the terminal page.
hostname = displays the Linux system normal hostname.
whoami = displays the Linux system normal user name.

basic linux command

sleep = delay in command (example= sleep 1- 1 sec second)
cal year =shows the calendar of the given year.( cal 1997 |less)
top = it shows the currently running process(memory usage or CPU usage, etc)
ps = viewing the process running on the system.
date = this command displays the current date and time. It can also be used to display or calculate a date in a format you specify. The super-user (root) can use it to set the system clock.
time = it can be used to show how long a command takes to run.
history = The history command shows a list of the commands entered since you started the session.
echo = it is printing what we are giving. ex( echo “hello” or echo hello will prints hello in the next line).
shutdown = (shutdown –P now = shutdown Linux os now itself).
pwd = it will print the current working directory.

Professional Training Institute is a pioneer in the embedded system training in Bangalore. Our teaching method is completely practical and hands-on. Explore more here