Linux commands for System Administration

Hereโ€™s aย list of basic Linux commands for system administration, along with examples and short explanations for each:

Sure! Here’s a list of basic Linux commands for system administration, along with examples and short explanations for each:

๐Ÿ—‚๏ธ 1. File and Directory Management

CommandDescriptionExample
lsList directory contentsls -l /home/user/
cdChange directorycd /var/log
pwdShow current directorypwd
mkdirCreate directorymkdir /opt/testdir
rmRemove files or directoriesrm file.txt rm -r folder/
cpCopy files/directoriescp file1.txt file2.txt
mvMove/rename filesmv oldname.txt newname.txt

๐Ÿง‘โ€๐Ÿ’ป 2. User Management

CommandDescriptionExample
adduser or useraddAdd new useradduser john
passwdSet or change user passwordpasswd john
deluser or userdelDelete useruserdel john
usermodModify user accountusermod -aG sudo john
whoamiDisplay current userwhoami
idShow user ID and groupsid john

๐Ÿง  3. System Information

CommandDescriptionExample
uname -aSystem infouname -a
topReal-time process monitoringtop
htopInteractive process viewer (needs install)htop
df -hDisk usagedf -h
free -hMemory usagefree -h
uptimeSystem uptimeuptime
hostnameShow/set system hostnamehostname

โš™๏ธ 4. Process Management

CommandDescriptionExample
ps auxShow all running processesps aux
killKill process by PIDkill 1234
killallKill process by namekillall firefox
niceStart process with prioritynice -n 10 myscript.sh

๐Ÿ” 5. File Permissions

CommandDescriptionExample
chmodChange file permissionschmod 755 script.sh
chownChange file ownerchown user:group file.txt
ls -lView permissionsls -l

๐Ÿ“ฆ 6. Package Management (Debian/Ubuntu)

CommandDescriptionExample
apt updateRefresh package listsudo apt update
apt upgradeUpgrade packagessudo apt upgrade
apt installInstall packagesudo apt install nginx
apt removeRemove packagesudo apt remove nginx

๐Ÿ“‚ 7. Service Management (SystemD)

CommandDescriptionExample
systemctl startStart servicesudo systemctl start nginx
systemctl stopStop servicesudo systemctl stop nginx
systemctl statusCheck statussudo systemctl status nginx
systemctl enableEnable service at bootsudo systemctl enable nginx

๐ŸŒ 8. Network Commands

CommandDescriptionExample
ip aShow IP addressesip a
pingPing a hostping google.com
netstat -tulnShow listening portsnetstat -tuln
ss -tulnAlternative to netstatss -tuln
curlTransfer data from URLcurl https://example.com

๐Ÿ“ 9. Archiving and Compression

CommandDescriptionExample
tarArchive filestar -czvf backup.tar.gz /home/user/
gzipCompress filegzip file.txt
unzipUnzip fileunzip file.zip

๐Ÿงช 10. Log Monitoring

CommandDescriptionExample
tail -fLive view of logstail -f /var/log/syslog
catView file contentcat /etc/passwd
lessScrollable file viewerless /var/log/dmesg
Scroll to Top