There are Countless number of commands in linux.In this article,we will introduce you a list of most frequently used Linux Commands with their examples for easy learning.For Basic Refer this link COMMANDS
To add a new user,you have to follow “useradd” or “adduser” with ‘Username’.The ‘Username’ is a user login name,this is used by user to login into the system.
The bellow command will create an alias called home for /home/tecmint/public_html directory.whenever you type home in the prompt,it will put you in the home/folder/public_html
In contrast,cron allows job to run as often as every minute while anacron will remember the job(if system is down)and execute it when system is up.
It is used to search the man page files in OS.It is particularly useul when searching for commands without knowing their exact names.
It is a Powerful text-based interface to Linux package management system.It can be used to install,remove,or upgrade software packages on a system.
sudo aptitude update
arch ia a simple cmd for displaying about machine architecture or hardware name(like uname -m)
It displays the kernel’s ipv4 network.ARP stands for Address Resolution Protocol,which is used to find the address of a network neighbor for a given IPV4 address.
It is used to schedule task to run in a future time.It si alternative to cron and anacron.howerver it runs a task once at a given future time without editing any config files.
For example,to shutdown the system at 22.50 today,run:
sudo echo "shutdown -h now" | at -m 22:50
atq command is used to view jobs in at command queue:
It is used to remove/delete jobs from command queue:
$ atrm 2
It is also used to schedule task to run a future time,similar to the “at command”
It helps to print the name os the file of directories in the absolute path
bc ia a simple CLI calculator language which can be used:
echo 10.05 + 10.00 | bc
It is used to send the process to the background.
tar -czf home.tar.gz.bgjobs
It is used to compress or decompress files
bzip2 -z filename #compress
Cal cmd print a calendar on the standard output
It is used to view contents of a file and display it on standard output
It is used to change the group ownership of a file.provide the new group name as its first argument and the name of the file as the second argument like this
chgrp xxx user.txt
It is used to change/update file access permissions like this
chmod +x sysinfo.sh
chown cmd changed/updates the user and group ownership of a file like:
chown -R www-data:www-data /var/www/html
Clear cmd lets you clear the terminal screen,simply type
It performs a byte-by-byte comparison of two files like this
cmp file1 file2
It is used to compare two sorted files line by line as shown below
comm file1 file2
It is used for copying files and directories from one location to another
cp /home/../file1 /home/../personal/
It displays/set the system date and time like
date date --set="8 JUN 2027 12:00:00"
IT is used to show file system disk space usage a follows
It is used to compare two files line by line.
diff file1 file 2
It works like Linux ls command.It list the content of a directory
It is a tool for retrieving hardware information of any linux system
sudo demidecode --type system
It is used to show disk space usage of files present in the directory as well as its sub-directories as follows
This command prints a text of line provided to it.
echo "This is VPS"
It is used to eject removable media such ad DVD/CD ROM or floppy disk from the system
It is list all the current environment variables and used to set them as well.
It is used to exit a shell like so
It is used to an calculate an expression as shown below
It is used to show the prime factors of a number
It is used to search files in a directory as well as its sub-directoried. It searches for files by attributes such as permission,users,groups,file-type,date,size .
find /home/vps -nme vps.txt
IT shows the system memory usage including swap space.”-h” options to display output in the human friendly format.
This command searches for special pattern in a file and displays in output lines containing that pattern as follows
grep 'vps' *.txt
It displays all the names of groups a user is a part of like this
It is helps to compress a file,replaces it with one having a .gz extension as shown below
gzip *.txt cat file1 filw2 | gzip>*.gz
It expands or restore file compressed with gzip command like
It is used to show first lines(10 lines by default)of the specified file or stdin to the screen
ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head
It is used to getinfo about command executed by a user
It is used to print or set system hostname in linux
hostname hostname NEW_HOSTNAME
It is used to print or modify the system hostname and related settings
hostnamectl sudo hostnamectl set-hostname NEW_HOSTNAME
It is used to probe for the hardware present in a linux system like
sudo hwclock sudo hwclock --set --date 8/06/2017
It shows user and group information for the current ise name as shown below
It s used to configure a linux system network interfaces.It is used to configure,view and control network interfaces
$ ifconfig $ sudo ifconfig eth0 up $ sudo ifconfig eth0 down $ sudo ifconfig eth0 172.16.25.125
It is used to set or view process I/O scheduling class and priority of the specified process
$ ionice -c 3 rm /var/logs/syslog
$ sudo ip addr add 192.168.56.10 dev eth1
$ sudo iptables -L -n -v
$ iw list
$ iwlist wlp1s0 scanning
It is used ti kill a process using PID(Process ID) by sending a signal to it.
kill -15 pid
It is used to kill process by its name
It is used to list all currently loaded modules.
It display a listing of last logged users.
It is used to find a file by name
locate file1 dir1
It is used to create a new session with the system.
It is used to list contents of directory.
ls -l file1
It is used to get detailed information of hardware configuration of the machine.
It is used to dislpay system’s CPU architecture information like cpu,threads,cores.
It is used to view the manual pages for commands/programs like
man du man df
2.mkdir command’more command
It is used to create single or more directories.
It is useful to move a file from one location to another.
mv file.sh file1.sh
It is a popular,free and friendly text editor for linux.
It shows the number of prcessing units present to the current process.
- openssl command
It will create an archive of all the files in the current directory and encrypt the contents of the archive file.
$ tar -czf - * | openssl enc -e -aes256 -out backup.tar.gz
passwd command is used to create and update passwords for user accounts.Note that normal system users may only change the password of their own account, while root may modify the password for any account.
pidof displays the process ID of a running program/command.
ping command is used to determine connectivity between hosts on a network
pwd command displays the name of current/working directory as below.
reboot command reboot a system as follows
rename command is used to rename many files at once. If you have a collection of files with “.html” extension and you want to rename all of them with “.php” extension, you can type the command below.
$ rename 's/\.html$/\.php/' *.html
rm command is used to remove files or directories
$ rm file1 $ rm -rf my-files
rmdir command helps to delete/remove empty directories
$ rmdir /backup/all
It schedules a time for the system to be powered down.
It is used to delay for specified amount of time
$ check.sh; sleep 5; sudo apt update
It is used to split the large file in to small file
It is used to show a file or file system status like this
This command concatenates and displays files in reverse.Its simply prints each file to standard output,showing last line first.
It is used to display the last(default 10 lines)line of each file to standard output
It is used to talk to another system/network user.
$ talk person [name]
It is for archiving file in linux
$ tar -czf home.tar.gz .
Its runs programs system resource usage
$ time wc /etc/hosts
It is used to create a file.
It display system information such us OS,Hostname,Kernel name,releases and etc.
It displays repeated lines from standard input.
It shows how long the system has been running
It shows the usernames of the users logged into the current host like
It is used to edit all kind of plain text and program files.
It display the system uptime,load avf and information about the users currently on the machine like
It is used to send/displays a messages to all the users on the system as follows
wall "Hai all"
It is used to watch changes to a file/directory.
watch -d ls -l
It is used to display newline,word,and byte counts for each file specified.
It is used to download files from the web.
It display the absolute path of files
It shows the information about the user.
It helps up locate the binary,source and manual files for commands
- xargs command
It is useful utility for reading items from the standard input.
- yes command
It is uesd to display a string repeatedly until when terminated or killed using “cntrl+C”as follows
$ yes "This is-Learn
It is light weight command line programe t download videos
$ youtube-dl --list-formats https://www.youtube.com/watch?v=iR
It is used to compare compressed files as shown below.
$ zcmp domain-list.txt.zip basic_passwords.txt.zip $ zdiff domain-list.txt.zip basic_passwords.txt.zip
It is silmple and easy to use utility used to package and compress files
"tar cvzf *.tar.gz dirname/"
This offers quick access to files and directories in linux.