Mastering Linux Basics: Essential Commands Every User Should Know
![]() |
Mastering Linux Basics: Essential Commands Every User Should Know
Are you ready to elevate your Linux proficiency? Whether you're a newcomer or a seasoned user, mastering essential Linux commands is key to navigating the powerful world of open-source computing. In this guide, we'll walk you through some fundamental commands that form the backbone of Linux operations.
Note : www.chmod.calculator.com
| Command | Example | Purpose |
| ls | ls | view all files in current folder |
| ls -R | ls R | will show current files and the nested files |
| pwd | pwd | view your pressent working folder |
| cd folder name | cd Download | control will goes to Download folder |
| cd .. | cd .. | back to previous folder |
| mkdir folder name | mkdir Images | it will create new folder with Images name |
| rmdir folder name | rmdir Images | Images folder will be delete |
| rm -r folder | rm -r Images | Images folder will be delete |
| vim file.txt | vim test.js | if test.js file exit it will open this file in editing mode otherwise it will create new file test.js then will open it in editing mode |
| :wq | :wq | will save and exit changes that you made in file after opening with vim editor |
| :q! | :q! | will exit wile from vim without saving |
| cp filename backupFile name | cp test.js backup.js | it will create one more copy of test.js with backup.js name with all content |
| mv filename Destination | mv test.js. user/test.js | it will move test.js file in side user folder |
| touch filename | touch info.js | it will create info.js file |
| cat filename | cat info.js | to view content of file |
| htop | htop | will show system usage report |
| ps | ps | will show all running process with PID |
| kill pid | 2915 | will stop the this program that was running on this pid |
| lsof -i :8080 | lsof -i :8080 | will show which service running on port 8080 |
| ps aux | grep java | ps aux | grep java | will show java running at which port, so you can other services as well |
| ls -lart | ls -lart | will show all hidden files |
| chmod permission file/folder name | chmod 744 test.js | to change permission of any file or folder |
| tar cf tarfile.tar file1.js file2.js | tar cf compressed.tar inof.js test.js | compressed.tar file will be created that will contain info.js and test.js |
| tar xf tarfile.tar | tar xf compressed.tar | will extract files |
| ssh | ssh user@serverip | used to login to remote server |
| scp file.txt 2ndserverip: path | scp file.txt user@serverip: /User | it will copy file.txt from current server to 2nd server at /User |
| ping sitenaem | ping www.google.com | test network conectivity |
| netstat | netstat | use to check network status |
| vi /etc/passwd | vi /etc/passwd | show to list of users |
| useradd username | useradd usama | will add new user at system this this user also can login to your system |
| passwd username | passwd usama | your can rest user password |
| userdel username | userdel usama | will delete your user from system |
| su username | su usama | swith user |
| groupadd groupname | groupadd WindowUser | will creat new group |
| cat /etc/group | cat /etc/group | will list the all groups |
| usermod -a -g groupName userName | usermod -a -g usama WindowUser | used to add user on group |
| groupdel groupNamep | groupdel WindowUser | used to delete group |
| df | df | give details about disk usage |
| date | date | show current date and time |
| whoami | whoami | will show the name of current logged in user |
| which program name | which node | will tell the path where node is installed |
| fingure username | fingure rizwan.zafar | will show all detail of this user |
| uname -a | uname -a | will show os system information |
| history | history | will show list of your all previously executed commands |
| locate filename | locate test.js | will tell the path of this file |
| sort filename | sort test.js | will sort the lines of file alphabetically order |
| uniq filenmae | uniq test.js | will remove duplcate entries from file |
| head filename | head test.js | will show starting some lines of file |
| head 2f filename | head 2f test.js | will show first 2 lines of file |
| tail filename | tail test.js | will show last some lines of file |
| tail 2f filename | tail 2f test.js | will show las 2 lines of file |
| systemctl | systemctl | show all running services |
| systemctl status serviceName | systemctl status sshd.service | show status of specific running service |
| systemctl start serviceName | systemctl start sshd.service | to start service |
| systemctl stop serviceName | systemctl stop sshd.service | to stop service |
| systemctl restart serviceName | systemctl restart sshd.service | will restart service and its pid will change |
| systemctl reload serviceName | systemctl reload sshd.service | will reload service but pid will not be change |
| systemctl enable serviceName | systemctl enable sshd.service | to enable service |
| systemctl disable serviceName | systemctl disable sshd.service | to disable service |
| a2enmod moduleName | a2enmod python | is used to install a module |
| a2dismod moduleName | a2dismod python | used to disable module |
| a2ensite siteName | a2ensite 000-default | used to enable a site |
| a2dissite siteName | a2dissite 000-default | use to disable site |
| top | top | can moniter , memory and cpu |
| free | free | to check free memory, add -m for mb or -g for gb with free command |
| iostat -c | iostat -c | tells about cpu utiliseation |
| iostat -d | iostat -d | tells about cpu utilization |
| watch free | watch free | tells live status of memory |
| vmstat | vmstat | detailed about disk |
| mpstat -P ALL | mpstat -P ALL | -- |

0 comments: