Linux commands

Basic linux commands

Linux commands

Here I have listed basic linux commands that are used in day to day life. The commands are divided into 7 parts, basic linux commands, process commands, user management commands, hardware commands, network commands, system information commands, file permission commands.

Some basic Linux commands

Commands Description
ls
List all files in the present working directory
ls -R
List files in sub-directories as well
ls -a
List hidden files
ls -al
List al files with detailed information like permission, size, owners etc.
cd or cd ~
Navigates to the HOME directory
cd -
Navigates to previous directory
cd /
Moves to root directory
cat > filename
creates the new file
touch filename
creates a new file
cat file1 file2 file3 > file4
joins two or more files and stores the output in a new file

Process commands

Commands Description
bg
To send a process to the background
fg
To run a stopped process in the background
top
Details of all active process
ps
Give the status os preocesses of a user
ps PID
Give the status of particular process
kill PID
Kill a process
nice
Start a process with a given priority
df
Gives free hard disk space on your system
free
Give free RAM on your system

User Management commands

Commands Description
sudo adduser username
To add a new user to your current linux machine
sudo userdel -r “username”
deluser removes a user from a specific group

Hardware commands

Commands Description
dmesg
Displays
cat /proc/cpuinfo
Display more infoprmation about CPU
cat /proc/meminfo
Display more information about hardware memory
lsusb
Display information about USB devices
lsblk
Display block devices related information
free -m
Displays free and used memory in the system
lspci -tv
Dislpays PCI devices in a tree like diagram
lsusb -tv
Dislpays USB devices in a tree like diagram
dmidecode
Display hardware information from the BIOS

Network commands

Commands Description
whois domain
Retrives more information about a domain name
dig domain
retrives DNS information about a domain name
dig -x host
Performs reverse lookup on a domain
host google.com
Performs a IP lookup for a domain name
hostname -I
Display local IP address
wget filename
Download a field from online source
netstat -pnltu
Display all active listining ports
quit
logout

System information commands

Commands Description
time
It is a utility to measure the time taken by a programe to execute
/proc
The files under /proc displays system infromation
df
Displays the information about the space on the mounted file-system
who
Displays informationa bout the logged in user including their login time
users
Prints the name of the currently logged in user
last
This command displays the time of the logged-out users.
lastlog
Displays a list of the users and the time/day of their login
whoami
It displays the username of the logged in user
free
Displays memory status
uptime
It is used to display the how long the computer has been up and running

File permissions commands

Commands Description
ls -l
To show file type and access permissions
chown -hR root /u
Change the owner of /u and subfiles to "root"
chown root /u
Change the owner of /u to "root"
chown root:staff /u
Likewise, but also change its group to "staff"
chmod +x filename
To make a programme executable
Spread the love

Leave a Comment

Your email address will not be published.