most important command in linux

In This Tutorial, we will Learn About The Most Important Commands In Linux which are always use in Linux, Ubuntu, CentOS, Debian. These commands are used in all Linux Distributions Linux/Ubuntu/UNIX/CentOS, Fedora, Debian, etc. These commands are required to work in the Terminal of Linux.these commands are used daily basis for every system administrator and Linux user.

Display System Calender

With this command, you can see the calendar of any year.

Syntax: cal [option] [year]

[root@simitech ~]# cal -y

OR

[root@simitech ~]cal 2020

OptionsDescriptions
cal Display month’s calendar will be a show
cal month year Display a specific month Calendar

Check and Modify System Date

more tutorial about system Change system date and time, Click Here

system timezone

Check system time zone execute bellow command

change system time zone

List of time zones

Create Files

touch: when you want to create more than one empty file use the touch command.

[root@simitech ~]# touch data

[root@simitech ~]# touch data1 data2 data3

touch data_{1..100}To create 100 or more files in one command

Nano: Create a new file and modify the existing file

[root@simitech ~]# nano data

to save and exit from the Current file press ctrl +x from the keyboard.

cat: cat is a most Important Commands In Linux It is used to create new data files. to save and exit from the file press ctrl +x from the keyboard.

[root@simitech ~] cat > data

show the content of the file .

[root@simitech ~]# cat data

it use to add new content in the file

[root@simitech ~] cat >> data

vim: vim is a most important command in Linux/Ubuntu/Centos etc. from this command we can create, modify the file, vim is an improved version of vi. Click here for a complete tutorial on the vim.

[root@simitech ~]# vim data

Create And Delete Directory

mkdir is a most Important Commands In Linux. it Create the specified Directory

[root@simitech ~]# mkdir data

Remove or delete file and Directory from the system use bellow command

rm -rf DirectoryName { Delete Directory without confirmation }.

rm -f FileName { delete file without confirmation}.

[root@simitech ~]# rm -rf LinuxData

[root@simitech ~]# rm -rf data

cd (Change Directory)

Change the Current Directory. if you type the cd command without any option, this command changes to the current user’s home DIrectory. To enter or exit any directory, use this command.

[root@simitech ~]# cd LinuxData

OptionsDescriptions
cd enter and exit to user home Directory
cd /var/www/htmlswitch to the specific Directory by path name
cd ..switch to parent Directory

Copy File And Directory

cp: [option] [source] [destination]

Copies one source file to a Destination file or copies multiple source files to a destination file that must be an exiting Directory.

The following command used to copy file source to Destination.

the command used to copy Directory from Source To Destination.

The bellow command use to copy Directory from Source To Destination.

copy file from one location to another in Linux

it’s use to copy file and Directory from source to Destination with Rename

move File And Directory

mv: Move one source file or Directory to a Destination file or move multiple source files and Directory to a destination file that must be an exiting Directory.

mv [option] [source] [destination]

[root@simitech ~]# mv data /var/www/html/NewData # move file

[root@simitech ~]# mv LinuxData /var/www/html # move dir

Getting Help

man

man is a system manual pager. it provide a quick way to get information most of the utility installed on the system.

[root@simitech ~]# man date [root@simitech ~]# man mkdir

info

Similar to man command but it is more depth.run info without page urges to list all pages. info page provides information like website.

[root@simitech ~]# info cal

whatis

display short Description of command

[root@simitech ~]# whatis df

[root@simitech ~]# whatis ls

The Help option:

Displays brief summaries of built-in commands. If PATTERN is specified, give detailed help on all commands matching PATTERN, otherwise, the list of help topics is printed.

[root@simitech ~]# help cal

[root@simitech ~]# help time

logout Command

Exits From the current session and display login screen. this command use only in text mode session. do not use it when GUI is running.

[root@simitech ~] logout

shutdown

the shutdown is the most Important Commands In Linux. This command is used to shut down the system. You can do this command only in text mode. You must have root privileges to run this command.

[root@simtech ~]# shutdown

optionsDescription
shutdown -r nowrestart the system without delay
shutdown -s now
shutdown -h +2 halts the system in two minutes

startx

This shell scripts,typically supplied with X11 distributions, enable you to start an X Session from the Current User Account.

[root@simitech ~]# startx

Su,sudo (Switch User)

Create a new shell session with a different User’s id and Privileges. if you run su command without specifying a username, you create a shell for the superuser ( root) . that is a user who has gained the root user’s privileges

[root@simitech ~]$ su

Switch to another user

[root@ simtech ~]# su siya

tty (teletypewrite)

The use of this command gives information about which terminal it is logged from.tty stand for teletypewriter. But it is popular with the user in the name of the terminal.

[root@simitech ~]# tty /dev/pts/0

chfn (Change Finger)

chfn stand for change finger, This command is used to add and modify the user’s finger information. This information is stored in the file /etc/passwd.including full name, office phone number, address

chfn change finger for a specific user

hwclock

Display Or set the system ‘s hardware clock . hardware clock are different from system clock , a time keeping routine that is the part of the Linux Kernel although the two are synchronized when you start the system

Syntax hwclock –set –date=’MM/DD/YYYY hh:mm:ss’

[root#simitech ~]# hwclock –set –date=’10/10/2020 11:40:10

id command

This command Displays the User’s own ID information, including User ID and Group ID and number.

display the user and Group Id Information in Linux

uname

print certain system information including system architecture, kernel release , kernel version,print processor, os Information etc.

[root@simitech ~]# uname -a # or uname –all

optionDescription
uname -n, –nodenameprint the network node hostname
-r, –kernel-releaseprint the kernel release
-v, –kernel-versionprint the kernel version
uname –p, –processorprint the processor type
uname –helplist all options
-o, –operating-systemprint the operating system
uname -mprint the machine hardware name

uptime:

Display the current time, amount of time the system has been running in the current login session, the number of users logged in the system, and average CPU Load.

Show system uptime and cureent user logged in linux

Display brief list of the current user login to the system

w or who command

With the help of this command, how many users are logged in the system and including which terminal are they using, when they logged on, information about CPU Usage.

display how many users are logged in  the system in linux

whoami

With the help of this command, display the username of the user currently login in the system.

[root@simitech ~]# whoami root

pwd

PWD stands for print working Directory, With the help of this command, we can find out which directory is currently in it.

[root@simitech ~]#pwd root

history

the shell keeps track of the command you have entered, it shows a history list in which each command is given a unique number. delete history from the system use history -c.

[root@simtech ~]# history

bc command

With the help of this command you can use your system calculator

Use system Calculator in the Linux

jobs

With the help of this command, you can find out how many jobs are running in the system and suspended jobs.

[root@simitech ~]# jobs

ps command

With this command, we can find out how many processes are running in the system. more details about ps use man helping command.

ps command display the system process

kill command

Terminate the process specified ID. to kill the process, you must be the owner or have a superuser privileges

[root@simitech ~]# kill 2445

top command

Display all running Process in the system, count number of running task , cpu usage,Users login Details, and PID etc.

adduser

user creation is a most important command in Linux, With this command, a user can be created in the system, All information of the user is stored in the /etc/passwd file. At the same time of creating a user, his home directory is also created /home/ location.

add user in Linux

add group and set passwd

With this command, a group can be created in the system, All information of the group is stored in the /etc/group file. bellow command we are creating a sales group

[root@simitech ~]#groupadd sales

set password to the group

set password to the group in Linux

To delete a group from the system from bellow command.

[root@simitech ~]# groupdel sales

delete user

this command delete user from the system but don’t delete his home directory

[root@simitech ~]# userdel siya

Remove user as well as his home Directory

[root@simitech ~]# userdel -R siya

Add user in Group

syntax usermod -G [groupname] [username]

You can add a common user to the Specify group

[root@simitech ~] usermod -G sales siya

Lock system User

usermod -L [username]

[root@simitech ~]#usermod -L siya

Unlock or enable system user

usermod -U [username]

[root@simitech ~]# usermod -U siya

The command name ‘chage’ stands for ‘change age’ This command can be used to change the user’s password aging/expiry information.

syntax: chage -l [username]

You can change information of particular user

administrator can set password expiry date for a specific user

syntax: chage -d [year]-[month]-[date] username

[root@simitech ~]# chage -d 2020-10-05 siya

wc (word count)

With the help of this command, you can display the word, character, line number, and byte of any file.

syntax: wc [option] [filename]

[root@simitech ~]# wc -l data1 356 data

OptionDescriptions
wc -l only line count
wc -c for only byte count
wc -wonly word count
wc -m for only charector count

ls command

List the content of the current Directory and file OR Specific Directoryand file .

ls [option] [file or Directory]

[root@simitech ~]# ls -la

Display all file and Directory in linux Command
optionDescription
ls -R list subdirectories recursively
ls -alist included hidden file
ls -lDisplay Extra Information

rmdir

Syntax : rmdir [empty Directory Name]

this command use to Delete Empty Directory

[root@simitech ~]# rmdir data

Network tools

ifconfig

With the help of this command, you can see the information of the system Ethernet, such as IP address netmask, broadcast Address, MTU status attached network Card, It is used at boot time to set up interfaces as necessary.

ip addr showDisplay ethernet Configuration
ifdown [ethernet device name]
nmcli connection down [device name]
Ethernet disable
ifup [ethernet device name]
nmcli connection up [device name]
Ethernet enable

df commad

df shows the all mounted partition.df displays the amount of disk space available on the file system containing each file name argument. If no filename is given, the space available on all currently mounted file systems is shown. Disk space is shown in 1K. df -h show mount partition in Human Readable format,

 df shows the all mounted partition in Linux

du command

With the help of this command, you can see the report of the disk usage of the system, which files and directories have taken how much disk.

lscpu

Display all System Cpu Architacture Related Information.

clear

Using this command, you can clear the content being displayed in the system.or Use Short Cut key ctrl+l.

[root@simitech ~]# clear # Clear system Screen

last

last, lastb – show a listing of last logged in users.

show a listing of last logged in users in Linux

lsusb

lsusb is a utility for displaying information about USB buses in the system and the devices connected to them.

[root@simitech ~]# lsusb

ps

pstree shows running processes as a tree.

[root@simkitech ~]# pstree

hdparm

hdparm display hard drive related parameter and test performance.

[root@simitech ~]# hdparm

vmstat

vmstat displays information about processes, memory, paging, block IO, traps, disks, and CPU activity.

vmstat displays information about processes, memory,CPU in Linux

In this Tutorials, we learned About the most Important commands in Linux. I hope that now you are comfortable in Any open-source operating system. If your problem is still not solved share your Problem via comments.

Related Posts