Friday, 31 May 2024

Deep delve into Linux commands with screenshots Part-2

Hello Friends, Thanks for coming here to read my blog, Welcome to my blog.

Here, We will discuss some basics Linux commands with screenshots.....


Note  : I have used online terminal to practice / for taking screenshot purpose. Search in website you guys will get so many online terminal to practice Linux commands.

Okay ! Let's learn some more commands.


File and Navigation Linux Commands:


1. ls : Directory listing , List all files and directory present in the current directory.




2. ls -la : List all files and directory present in the current directory including hidden files.





Here, KKP and KKPP are not hidden, Remaining . and .. directories  are hidden.

3. ls -l : long listing or formatted listing.



4. Change directory(cd)   :
  • cd dir : Change to directory
  • cd .. : change to parent directory
  • cd../ : change to another directory in parent directory
  • cd or cd~ : Change to home directory
Ex:
=============

$ ls -ltr
total 16
-rw-r--r-- 1 webmaster webmaster    0 May 31 16:45 KKPP
drwxr-xr-x 2 webmaster webmaster 4096 May 31 16:58 kkp4
drwxr-xr-x 2 webmaster webmaster 4096 May 31 16:58 kkp3
drwxr-xr-x 2 webmaster webmaster 4096 May 31 16:58 kkp2
drwxr-xr-x 3 webmaster webmaster 4096 May 31 16:59 KKP
$ cd KKP
$ pwd
/home/cg/root/6659b10b30e29/KKP
$ cd ..
$ pwd
/home/cg/root/6659b10b30e29
$ cd KKP
$ ls -ltr
total 4
-rw-r--r-- 1 webmaster webmaster    0 May 31 16:59 kkp
drwxr-xr-x 2 webmaster webmaster 4096 May 31 16:59 kkp2
-rw-r--r-- 1 webmaster webmaster    0 May 31 16:59 23.txt
$ cd kkp2
$ pwd
/home/cg/root/6659b10b30e29/KKP/kkp2






5. rm : It is a remove command we used to remove file/directory in the Linux machines

Sub Commands :

==================
  • rm -f : delete file
  • rm -r : Delete directory
  • rm -rf : delete directory forcefully





6. cp  : This is copy command, we can use this for copy files/directory from one location to another location.


7. mv : Move command is used to rename the files name.



Moving file to inside a directory, Here is the Example

$ ll
total 96
drwxr-xr-x    3 webmaster webmaster  4096 May 31 17:34 ./
drwxrwxrwt 1832      1003      1003 86016 May 31 17:38 ../
drwxr-xr-x    2 webmaster webmaster  4096 May 31 17:29 TECHNO/
-rw-r--r--    1 webmaster webmaster     0 May 31 17:27 Technology
-rw-r--r--    1 webmaster webmaster     0 May 31 17:26 kkp
-rw-r--r--    1 webmaster webmaster     0 May 31 17:26 kkp2
$ cd TECHNO
$ ll
total 8
drwxr-xr-x 2 webmaster webmaster 4096 May 31 17:29 ./
drwxr-xr-x 3 webmaster webmaster 4096 May 31 17:34 ../
-rw-r--r-- 1 webmaster webmaster    0 May 31 17:29 kkp2
$ pwd
/home/cg/root/6659ba95a3bc3/TECHNO
$ cd ..
$ ll
total 96
drwxr-xr-x    3 webmaster webmaster  4096 May 31 17:34 ./
drwxrwxrwt 1839      1003      1003 86016 May 31 17:38 ../
drwxr-xr-x    2 webmaster webmaster  4096 May 31 17:29 TECHNO/
-rw-r--r--    1 webmaster webmaster     0 May 31 17:27 Technology
-rw-r--r--    1 webmaster webmaster     0 May 31 17:26 kkp
-rw-r--r--    1 webmaster webmaster     0 May 31 17:26 kkp2
$ mv kkp .TECHNO/

mv kkp .TECHNO/

mv: cannot move 'kkp' to '.TECHNO/': Not a directory

$ mv kkp ./TECHNO

mv kkp ./TECHNO

$ cd TECHNO

cd TECHNO

$ ll
total 8
drwxr-xr-x 2 webmaster webmaster 4096 May 31 17:39 ./
drwxr-xr-x 3 webmaster webmaster 4096 May 31 17:39 ../
-rw-r--r-- 1 webmaster webmaster    0 May 31 17:26 kkp
-rw-r--r-- 1 webmaster webmaster    0 May 31 17:29 kkp2

8. cat : This Command is used to view the content present in files.


Note : Here in above Screenshot kkp2 file contains nothing, i.e it is 0 bytes


 9. tail : This command is used to view the content of file and It will work based on the parameter.

  • Sub commands are
  1. tail -f : Used to show last 10 lines of file
  2. tail -100f : used to show last 100 lines of file.
Note : This command is used to tail the logs file in real time.


The same way we will use "head -f" command t9 display first 10 lines in the file.


This is enough for today.. we have so many commands to learn still will come up with them in my next blog.

Thanks for reading, Yours friend VK😊😊

No comments:

Post a Comment

Introduction to k8s

 Hello friends, Good Day! Hope you guys are doing well, I am writing here some basic terminology n introduction to kube8.. please do read n ...