50 Linux Commands You Should Know
ls - list the files and directories in the current directory
ex:-abhilash@DESKTOP-J286E82:~/harry$ ls
1.txt 2.txt harry1
pwd-print the current working directory
ex:-abhilash@DESKTOP-J286E82:~/harry$ pwd
/home/abhilash/harry
cd - change the current directory
ex:-abhilash@DESKTOP-J286E82:~/harry$ cd harry1
abhilash@DESKTOP-J286E82:~/harry/harry1$
mkdir - create a new directory
ex:-abhilash@DESKTOP-J286E82:~/harry$ mkdir harry2
abhilash@DESKTOP-J286E82:~/harry$ ls
1.txt 2.txt harry1 harry2
rmdir - remove a directory
ex:-abhilash@DESKTOP-J286E82:~/harry$ rmdir harry2
abhilash@DESKTOP-J286E82:~/harry$ ls
1.txt 2.txt harry1
cp - copy files or directories
ex:-abhilash@DESKTOP-J286E82:~/harry$ cp main.py main-backup.py
abhilash@DESKTOP-J286E82:~/harry$ ls
1.txt 2.txt harry1 main-backup.py main.py
{here escape :wq! is for saving the file while escape :q! is only for discard the changes in that file and it will be back to its original form)
mv - move or rename files or directories
ex:-abhilash@DESKTOP-J286E82:~/harry$ mv main-backup.py main-b.py {used for renaming the file)
abhilash@DESKTOP-J286E82:~/harry$ ls
1.txt 2.txt harry1 main-b.py main.py
another ex:-abhilash@DESKTOP-J286E82:~/harry$ mv main-b.py harry1 {used for moving the file main-b.py to harry1 directory}
abhilash@DESKTOP-J286E82:~/harry$ ls
1.txt 2.txt harry1 main.py
abhilash@DESKTOP-J286E82:~/harry$ cd harry1
abhilash@DESKTOP-J286E82:~/harry/harry1$ ls
main-b.py
rm - remove files or directories
ex:-abhilash@DESKTOP-J286E82:~/harry$ rm 1.txt{removing the file}
abhilash@DESKTOP-J286E82:~/harry$ ls
2.txt harry1 main.py
abhilash@DESKTOP-J286E82:~/harry$
another ex:-{removing the directory}
abhilash@DESKTOP-J286E82:~/harry$ rm -r harry1
abhilash@DESKTOP-J286E82:~/harry$ ls
2.txt main.py
touch - create a new empty file {or update the timestamp of an existing file}
ex:-abhilash@DESKTOP-J286E82:~/harry$ touch rohan.txt
abhilash@DESKTOP-J286E82:~/harry$ ls
2.txt main.py rohan.txt
cat - concatenate and display files
ex:-
abhilash@DESKTOP-J286E82:~/harry$ cat main.py
import os
print(os.listdir())
The first digit represents the owner of the file/directory
# The second digit represents the group that the file/directory belongs to
# The third digit represents all other users
chmod calculator link:-https://chmod-calculator.com/
- tar - create or extract compressed archive files
ex:-abhilash@DESKTOP-J286E82:~/harry$ tar cf rohan.tar rohan.txtabhilash@DESKTOP-J286E82:~/harry$ ls2.txt main.py rohan.tar rohan.txt
- gzip - compress files
- gunzip - decompress compressed files
ex:-
abhilash@DESKTOP-J286E82:~/harry$ gzip 2.txtabhilash@DESKTOP-J286E82:~/harry$ ls2.txt.gz main.py rohan.tar rohan.txtabhilash@DESKTOP-J286E82:~/harry$ gunzip 2.txt.gzabhilash@DESKTOP-J286E82:~/harry$ ls2.txt main.py rohan.tar rohan.txtabhilash@DESKTOP-J286E82:~/harry$
- ssh - connect to a remote server securely
- scp - securely copy files between systems
- ping - test network connectivity
- ifconfig - display or configure network interfaces
- netstat - display network connection information
- ps - display information about running processes
- kill - terminate a process
Comments
Post a Comment