Top Linux Commands for Linux Administrators
The essential tools for interacting with and controlling an operating system based on Linux are Linux commands.
Having command proficiency with these commands enables users to effectively interact with their systems, from file manipulation to system setup and network administration.
This thorough tutorial will explore the most important Linux commands, including tips, examples, and useful apps to help you become more proficient with Linux system operations and make the most of your command-line expertise.
Here are some useful Linux commands that may help you to do day-to-day work.
Files and Folders Related
Change Directory
cd /path/to/folderList files and directories in the path
ls -lhCheck current directory
PWDDelete the folder
rm -rf /path/to/directoryDelete the file
rm filenameCreate a symlink (shortcut)
ln -s /path/to/file /path/to/symlinkRead the file
cat /path/to/filetail /path/to/fileEdit the file
vi /path/to/filenano /path/to/fileCopy file
cp filename /path/to/destinationMove
mv -v /path/of/source /path/to/destinationRename the file
mv [options] source_file destination_fileTo find the path
For ex:- to find the nginx directory location
which nginxTo search the files or directory
find / -name "long.txt"Find Files on the System by name
mountEnables to mount even remote file system
locateChange the ownership of the file or directories
sudo chown user:group /path/to/directoryUse -R to recursively change the owner and groups for all underneath files and directories
sudo chown -R user:group /path/to/directoryCheck the permission of files and directories
ls -lChange permissions
sudo chmod 755 /path/to/filefor more information on octal values refer to https://www.thegeekdiary.com/linux-file-directory-permissions-cheat-sheet/
If you want to change the user owning this file or directory (folder), you will have to use the command chown. For instance, if you run
sudo chown username: myfolderthe user owning myfolder will remain. Then you can execute below command to add the write permission to the username user.
sudo chmod u+w myfolderif you want to add this user to the group associated with “myfolder”, you can run
sudo usermod -a -G groupname usernameand then execute to add the write permission to the group
sudo chmod g+w myfolderMemory and Processes Related
To check the running processes sorted by memory
ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%memThe other command is Top which gives some brief information about memory on the system and locations of the process
top -c -b -o +%MEM | head -n 100 | tail -100htopSimple Memory Check
free -mTo show the memory map of the Process
pmap {PID}Services Related
List down the services
systemctl --type=serviceto filter the running services only
systemctl --type=service --state=running Restart the Service
systemctl restart servicename Enable Service
systemctl enable service.nameDisable Service
systemctl disable service.nameTo clear the Service cache due to changes
systemctl daemon-reloadTo clear the failed Services from the list
systemctl reset-failedPorts and PID-Related
To know the Ports being used by running processes with PID
sudo ss -pluntsudo lsof -i -P -n | grep LISTENDisk Space Related
Check the space on Linux
df -hTo thoroughly check the space used by which path
du -h -d1 /path/to/folderTo show the “Top 10 directories”
du -Sh / | sort -rh | head -10OR
find / -type f -exec du -Sh {} + | sort -rh | head -n 10Delete large amount of files by date
If the files are not modified after initial creation, you could delete them if they have not been modified in over 90 days:
find /path/to/folder ! -type d -mtime +90 -exec rm -f {} +Show directory space usage.
duTo Increase the Disk Space
Please check this Article
Root Admin
To Enter the Sudo mode
sudo -iApp or Package Installation and Removal
To Install the app
CentOS Command
yum install app name*make sure the current repo is updated or the file is downloaded in case of manual installation
Ubuntu Command
apt-get install app nameTo remove the app
CentOS
yum remove app nameUbuntu
apt-get remove app nameUpdate or Patching the Linux
CentOS
yum update -yUbuntu
apt-get updateapt-get upgradeReboot
sudo rebootClear screen
clearCompress or Extract files or directories
ZIP/Compress the file or directories
tar -czvf archive.tar.gz /path/to/file or folderExtract file or folder
tar -xzvf filename.tar.gz -C /path/to/folderNetwork Related
Check the Private IP Address of the system
ifconfig -a ifconfig eth0Change the IP address
check this article on How to Change IP Address in Ubuntu: A Comprehensive Guide
To find out the public IP (Gateway outbound IP)
curl ifconfig.meCheck IP route
ip rCheck the traceroute
pathping www.google.comTrack network performance
mtr www.google.comto Check the opened connections
To display the program
netstat -pTo display the ports
netstat -sTo display route
netstat -rDNS related
Add Local Host record
sudo nano /etc/hostsCentOS
sudo nano
SSL or certificate related
Update Local CA Certificate
upload the local ca file pem or crt to your home directory via WinSCP
CentOS
cp mycert.crt /etc/pki/ca-trust/source/anchors/
update-ca-trust extractUbuntu
cp mycert.crt /usr/local/share/ca-certificates/
sudo update-ca-certificatesTime Date and Timezone related
Check timezone
ls -l /etc/localtimelist timezones
timedatectl list-timezonesset timezone
sudo timedatectl set-timezone name of the zone Firewall
Allow firewall port
firewall-cmd --permanent --zone=public --add-port=80/tcp
firewall-cmd --list-ports
firewall-cmd --reloadUser and Password Related
Create a new user with password
sudo adduser "username"
su - "username"
*enter the password twiceCreate a new user with ssh key and without a password
Ubuntu
sudo adduser "username" --disabled-passwordCent OS
sudo adduser "username"Run below commands further in Linux (works on both centos or ubuntu)
su - "username"
mkdir .ssh
chmod 700 .ssh
touch .ssh/authorized_keys
chmod 600 .ssh/authorized_keys Options to use PPK files
- Create a new SSH public key directly in the server, run the below commands (if you already have the key then skip to step 2.)
ssh-keygen -t rsa
cat >> .ssh/authorized_keysCopy the Public and Private keys to a .ppk file to your desktop, that will be used at a later stage to log in from Putty or WinSCP.
OR
2. if you need to use an existing SSH user public key or a key generated from puttygen software, run the below command and paste the public key
nano .ssh/authorized_keys Press Ctrl+X, Enter Y to save the file, and exit. Now, bypass the below steps and continue with next step to add user to sudo group
Exit from new user
exitallow user to wheel or sudo group to have no password access
Ubuntu
sudo usermod -aG sudo usernameCent OS
sudo usermod -aG wheel usernameEdit VIsudo
sudo visudoUbuntu
In the editor, add the following line at the very bottom, but before the #includedir statement.
username ALL=(ALL) NOPASSWD: ALLCent OS
Look for ##Allow root to run any commands anywhere, add the below line.
username ALL=(ALL) NOPASSWD:ALLMake sure you have added PermitRootLogin without-password in sshd_config if not then please add it to the below location
sudo vi /etc/ssh/sshd_configChange the password of the existing user
passwdGet the UID and GID for the users
cat /etc/passwdto get to know about a specific user
cat /etc/passwd | grep usernameList existing Users
cat /etc/passwd
less /etc/passwd
more /etc/passwdGroup Related
List existing Groups
cat /etc/group
less /etc/group
more /etc/groupAdd Existing User to the Group
sudo usermod -a -G groupName userNameWeb Related
To download the content
wget https://website urlTo test the website
curl https://website urlModules
To list the enabled modules in Linux
for example:- list the PHP modules installed
sudo dnf module phpSystem Information:
Display system information.
unameMonitor system resources.
top or htopCPU information.
lscpucat /proc/cpuinfoList block devices.
lsblk fdisk -lDisplay the system date and time.
dateConclusion
I hope the above Linux commands will be useful for your day-to-day operations managing the Linux server.
- Why should you automate Active Directory cleanup? - 17 June 2025
- Troubleshooting: Unable to Add Instance Failover Group to Azure SQL Managed Instance - 4 March 2025
- 10 Azure Virtual Desktop (AVD) Cost-Optimization Strategies for 2025 💡💰 - 22 February 2025



