Reading Time: 6 minutes
Linux is one of the best Operating System in the world. Linux adopts DOS technology and made to provide more features & compatibility to users. Linux is an open-source operating system, many programmers all around the world helping to refine Linux OS. The major Linux distros are Debian & Non-Debian Linux.
asic Linux Commands:
B Ubuntu is one of the best Linux based Debian distros. Windows is completely based on GUI and Linux is easier if you learn the commands. We provide the essential commands will help you use Linux more easily. The below commands will work on all Linux Distros. Jump To:
Hardware Linux Commands:
dmesg Command to
display bootup messages
cat /proc/cpuinfo Command to display more
information about CPU
cat /proc/meminfo Command to display more
information about hardware memory.
lshw Command to display information about the
device’s hardware configuration.
lsblk Command to display
block devices related information.
free -m Command to display
free and used memory in the system.
lspci -tv Command to display
PCI devices in a tree-like diagram.
lsusb -tv Command to display
dmidecode Command to displays
hardware information from the BIOS.
hdparm -i /dev/xda Command to display information about
hdparm -tT /dev/xda <:code> Command to conduct a
read speed test on device xda.
badblocks -s /dev/xda Command to test for
unreadable blocks on harddisk. A System Based Linux Commands:
Some essential system based Linux Commands are:
uname Command to display
Linux system information.
uname -r Command to display
kernel release information.
uptime Command to display how
long the system has been running including load average.
hostname Command to
show the system hostname.
hostname -i Command to display the
last reboot Command to show
system reboot history.
date Command to display
current system date and time.
timedatectl Command to
change the System clock.
cal Command to display the
current calendar month and day.
w Command to display
currently logged in users.
whoami Command to display
who you are logged in as.
finger username Command to display
information about the user. File-based Linux Commands:
Some essential file-based Linux Commands,
ls -al List all files.
pwd Command to
display the current directory file path.
mkdir ‘directory_name’ Command to
create a new directory.
rm filename Command to
remove a file.
rm -f filename Command to
remove a file forcefully.
rm -r directoryname Command to
remove a directory.
rm -rf directoryname Command to
remove a directory forcefully.
cp file1 file3 Command to
copy the contents of file1 to file3.
cp -r dir1 dir3 Command to
copy the content from dir1 to dir2.
mv file1 file3 Command to
rename file1 to file3.
ln -s /path/to/filename linkname Command to
create a symbolic link to filename.
touch filename Command to
create a new file.
cat > filename Command to
place standard input into a file.
more filename Command to
display output contents of a file.
head filename Command to
display the first 10 lines of a file.
tail filename Command to
display the last 10 lines of a file.
gpg -c filename Command to
encrypt a file.
gpg filename.ext Comand to
decrypt a file.
wc Command to print the
number of bytes, words, and lines in a file.
Command to executes command. Linux Commands to handle Users:
id Command to
display the details of the active user.
last Command to
show the last logins in the system.
who Command to
show who is logged in to the system.
groupadd “admin” Command to
add the group “admin”.
adduser “Rachel” Command to
add user Rachel.
userdel “Rachel” Command to
delete user Rachel.
usermod Command for
changing/modifying user information. Linux Commands to handle File Permission:
chmod octal filename Command to change file permissions of the file to octal
chmod 777 /home/sample.txt Command to set
rwx permissions to owner, group and everyone.
chmod 755 /home/sample.txt Command to set
rwx to the owner and r_x to group and everyone.
chmod 766/home/sample.txt Command to set
rwx for owner, rw for group and everyone.
chown owner file Command to change ownership of the file.
chown owner-user:owner-group filename Command to
change owner and group owner of the file.
chown owner-user:owner-group direc Command to
change owner and group owner of the directory. Process Related based Linux Commands:
ps Command to display
currently active processes.
ps aux | grep ‘telnet’ Searches for the
id of the process ‘telnet’.
pmap Command to display
memory map of processes.
top Command to
display all running processes.
kill pid Command to
terminates process with a given pid.
killall proc Command to
kill/terminate all processes named proc.
pkill process-name Command to
send a signal to a process with its name.
bg Command to
resumes suspended works in the background.
fg Command to bring
suspended works to the foreground.
job n to the foreground.
lsof Command to l
ist files that are open by processes.
renice 19 PID Command to make a
process run with very low priority.
pgrep chrome Command to
find Chrome process ID.
pstree Command to
visualize processes in tree model. Network-based Linux Commands:
ip addr show Command to display
ip address add 127.0.0.1/24 dev eth2 Command to assign IP address 127.0.0.1 to interface eth2.
ifconfig Command to display
IP addresses of all network interfaces.
ping host the
ping command sends an ICMP echo request to establish a connection to server.
whois domain Command to
retrieve more information about a domain name.
dig domain Command to retrieve
DNS information about the domain.
dig -x host Command to perform a
reverse lookup on a domain.
host tecrobust.com Command to perform an
IP lookup for the domain name.
hostname -i Command to
display local IP address.
wget file_name Command to
download a file from an online source.
netstat -pnltu Command to
display all active listening ports. Linux Command to handle Install Packages & Source:
sudo apt install package Command to
install APT package
sudo apt remove package Command to
remove an APT package
dnf install pkg_name Command to
Install the package using dnf utility
make install The command installs the binaries in the default/modified paths after the compilation
Linux Commands to handle compression:
tar -cf filename.tar home<:code> Command to create
archive file called ‘filename.tar’ from file ‘home’.
tar -xf file.tar Command to
extract archive file ‘file.tar’.
tar -zcvf etc.tar.gz source-folder Command to
create gzipped tar archive file from the source folder.
gzip file Create a
compressed file with .gz extension. Search Linux Commands:
grep ‘matching-pattern’ files Command to
search for a matching pattern in files.
grep -r provided-pattern dir Command to
search recursively for a pattern in a given directory.
locate file Command to
find all instances of the files.
find /etc/ -name “main” Command to find file names that
begin with ‘main’ in /etc folder.
find /etc -size +100k Command to find files
greater than 100k in the etc folder. File Transfer Linux Commands:
scp file.txt server/main Securely
copy file.txt to server in /main directory.
rsync -a /home/images /folder1/
Synchronize contents in /home/images directory with /folder1 directory. Login Linux Commands:
ssh [email protected] Securely
connect to host as username.
ssh -p port-number [email protected] Securely connect to
host using a specified port (22, 80, 443).
ssh host Securely connect to the server via SSH on default port 22.
telnet host Connect to host
via telnet default port 23. Directory Access Linux Commands:
cd .. Command to
move up one level in the directory.
cd Command to change directory to
cd /sample Command to
change directory to /sample directory. Verdict:
That’s it. These are the most commonly using Basic Linux Commands, If you have any queries and then comment us below.
Essential Linux Commands
For more articles, Kindly visit our