Sunday, 28 February 2021

LINUX - HOW TO USE ID COMMAND

 LINUX - HOW TO USE ID COMMAND
 
 

The command is as follows:-
 

Command :- id root

In the above example, we can see the use of ID command for the user - odadmin and adam.

The above command shows us the uid, group id and details of any supplementary groups for the users:- odadmin and adam.


LINUX - HOW TO REBOOT A SERVER IN LINUX

LINUX - HOW TO REBOOT A SERVER IN LINUX
 
The command is as follows:-
 

Command :-systemctl reboot

LINUX - HOW TO POWER OFF SERVER IN LINUX

 LINUX - HOW TO POWER OFF SERVER IN LINUX
 
The command is as follows:-
 

Command :-systemctl poweroff

Once the system is power off, the ssh connection will be disconnected.






LINUX - HOW TO UNZIP A FILE

 LINUX - HOW TO UNZIP A FILE
 
The command is as follows:-
 

Command :-tar -xvzf /home/odadmin/test1/compress.tgz

In the above command, we have unzipped the file compress.tgz file with the tar command as shown below.

After zipping the file we can see the 3 files:- sorted1.txt, sorted.txt and sorttest.txt as shown above.


LINUX - HOW TO USE TAR COMMAND TO COMPRESS FILE
 
The command is as follows:-
 

Command :- We can use the command tar -cvzf compress.tgz sort*. This will create a file compress.tgz which will have 3 files - sorted1.txt, sorted.txt and sorttest.txt


LINUX - HOW TO USE LESS COMMAND TO SEARCH IN LINUX

 LINUX - HOW TO USE LESS COMMAND TO SEARCH IN LINUX
 
The command is as follows:-
 

Command :-less test1.txt

The putput of the above command:-

Now you can go down by pressing ENTER key multiple times till you reach the end of the file.

You can press q to exit the search and return to the command prompt.




LINUX - HOW TO USE / COMMAND TO SEARCH IN A FILE

 LINUX - HOW TO USE / COMMAND TO SEARCH IN A FILE
 
The command is as follows:-
 

Command : The process is to edit the file using vi,vim or nano. In my case I am using VIM and will search the word NET in the fille test1.txt

I have performed a search for the word NET in the file test1.txt.

As we can see the word NET appears 4 times in the file.