Monday, January 22, 2024

Mastering Linux Basics: Essential Commands Every User Should Know

 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

CommandExamplePurpose
lslsview all files in current folder
ls -Rls Rwill show current files and the nested
files
pwdpwdview your pressent working folder
cd folder namecd Downloadcontrol will goes to Download folder
cd ..cd ..back to previous folder
mkdir folder namemkdir Imagesit will create new folder with Images
name
rmdir folder namermdir ImagesImages folder will be delete
rm -r folderrm -r ImagesImages folder will be delete
vim file.txtvim test.jsif 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:wqwill 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 namecp test.js backup.jsit will create one more copy of test.js
with backup.js name with all content
mv filename Destinationmv test.js. user/test.jsit will move test.js file in side user folder
touch filenametouch info.jsit will create info.js file
cat filenamecat info.jsto view content of file
htophtopwill show system usage report
pspswill show all running process with PID
kill pid2915will stop the this program that was
running on this pid
lsof -i :8080lsof -i :8080will show which service running on
 port 8080
ps aux | grep javaps aux | grep javawill show java running at which port,
 so you can other services as well
ls -lartls -lartwill show all hidden files
chmod permission file/folder namechmod 744 test.jsto change permission of any file or
folder
tar cf tarfile.tar file1.js file2.jstar cf compressed.tar inof.js test.jscompressed.tar file will be created
that will contain info.js and test.js
tar xf tarfile.tartar xf compressed.tarwill extract files
sshssh user@serveripused to login to remote server
scp file.txt 2ndserverip: pathscp file.txt user@serverip: /Userit will copy file.txt from current server
to 2nd server at /User
ping sitenaemping www.google.comtest network conectivity
netstatnetstatuse to check network status
vi /etc/passwdvi /etc/passwdshow to list of users
useradd usernameuseradd usamawill add new user at system this this
user also can login to your system
passwd usernamepasswd usamayour can rest user password
userdel usernameuserdel usamawill delete your user from system
su usernamesu usamaswith user
groupadd groupnamegroupadd WindowUserwill creat new group
cat /etc/groupcat /etc/groupwill list the all groups
usermod -a -g groupName userNameusermod -a -g usama WindowUserused to add user on group
groupdel groupNamepgroupdel WindowUserused to delete group
dfdfgive details about disk usage
datedateshow current date and time
whoamiwhoamiwill show the name of current logged
in user
which program namewhich nodewill tell the path where node is installed
fingure usernamefingure rizwan.zafarwill show all detail of this user
uname -auname -awill show os system information
historyhistorywill show list of your all previously
executed commands
locate filenamelocate test.jswill tell the path of this file
sort filenamesort test.jswill sort the lines of file alphabetically 
order
uniq filenmaeuniq test.jswill remove duplcate entries from file
head filenamehead test.jswill show starting some lines of file
head 2f filenamehead 2f test.jswill show first 2 lines of file
tail filenametail test.jswill show last some lines of file
tail 2f filenametail 2f test.jswill show las 2 lines of file
systemctlsystemctlshow all running services
systemctl status serviceNamesystemctl status sshd.serviceshow status of specific running service
systemctl start serviceNamesystemctl start sshd.serviceto start service
systemctl stop serviceNamesystemctl stop sshd.serviceto stop service
systemctl restart serviceNamesystemctl restart sshd.servicewill restart service and its pid will
change
systemctl reload serviceNamesystemctl reload sshd.servicewill reload service but pid will not be
change
systemctl enable serviceNamesystemctl enable sshd.serviceto enable service
systemctl disable serviceNamesystemctl disable sshd.serviceto disable service
a2enmod moduleNamea2enmod pythonis used to install a module
a2dismod moduleNamea2dismod pythonused to disable module
a2ensite siteNamea2ensite 000-defaultused to enable a site
a2dissite siteNamea2dissite 000-defaultuse to disable site
toptopcan moniter , memory and cpu
freefreeto check free memory, add -m
for mb or -g for gb with free command
iostat -ciostat -ctells about cpu utiliseation
iostat -diostat -dtells about cpu utilization
watch freewatch freetells live status of memory
vmstatvmstatdetailed about disk
mpstat -P ALLmpstat -P ALL--



Previous Post
Next Post

post written by:

0 comments: