Here's a list of some basic and useful Linux commands




Find (or Search) from ongoing operations
You already know ps touched upon the second part of the series, which is used to display information about the processes that occur in your command:
ps aux




But contrast do not know anything until the moment all things the most advanced in it, in fact, the above command is not useful when you want to search for a specific process-specific and is not listed all of the operations, and here comes the role of the command grep to merge with the ps command and earn additional power:
ps aux | grep ipython



Output will be as follows:
oltjano 8709 6.0 0.4 149684 18592 pts/0 Sl+ 13:53 0:00 /usr/bin/python /usr/local/bin/ipython
 oltjano 8712 0.0 0.0 13600 944 pts/4 S+ 13:54 0:00 grep --color=auto ipython



As you can see, it was given information that the program works ipython a Mtamoda in the path / usr / local / bin with the ID number of the current process id, a 8709

There is a trick to make it even gives us important information and ignore the information is important, and through the first letter in parentheses [] and the briefing process name my TM marks, using the following command:
ps aux | grep '[i]python'



Output will be as follows:

oltjano 8709 6.0 0.4 149684 18592 pts/0 Sl+ 13:53 0:00 /usr/bin/python /usr/local/bin/ipython


Ongoing operations killed using pid
Shortcut pid refers to the sentence "ID number of the process," easily kill any process you can if you learn of its own pid, and knowable by using the previous command ps, and the next thing generally kill the process that carry ID 8709, a ipython:

kill 8709



In this way the process was terminated.



Instead, the following Valomr extracted ID to automatically process and then look for himself and kills the process himself:

kill $(ps aux | grep '[i]python' | awk '{print $2}')


The following is a full explanation of the command:

First you run the command ps to the list of list of ongoing operations, and then convert it outputs ps using pipe tube (the tube in Linux commands to be this way | It is commonly used in the terminal for Linux, is this tube to transfer the output to the command grep then grep competent research sort results and filter depending on the search string in the matter in this case ipython and then is passed grep outputs using the tube again as inputs to the benefit of awk which gives us a second field of each line, and in this context, the second field contains the special process pid.



Accordingly, the output will be as follows:

oltjano 8709 6.0 0.4 149684 18592 pts/0 Sl+ 13:53 0:00 /usr/bin/python /usr/local/bin/ipython


It tar
It is used to store and extract files from tape or archival disk (archive disk), and you may have noticed that some of the files ending tar format, of course, the most common cases of the use of tar is to extract the archives and compressed files, through the following command:
tar xvf example.tar



To explain some of the components of the previous command:

V character refers to the verbose and comes word meaning "verbiage" This means that we say "your Balashab listed in the extraction process details," which means that it will show you what happens during the extraction process.

In the letter f refers to a word file and the x means extract (extract)



You can also use the following command to list the contents of archives without extracting:


tar tvf example.tar





Whether you want to create a new archive tar format. In the beginning you need to put the files you want to archive them together in a single folder, after putting them in a folder, and then use the following command:

tar cvf example.tar example/




C refers to the character to create an archive (creating), suggesting v to dwell on the details listed outputs, and it means the f file.

Reduce the size of files using gzip
gzip very useful tool for reducing the size of the files, especially if you want to attend over the network, and Here's how to use this ...

To create a compressed gz file format used the following command:



gzip test.txt





Unzip the file we use the following command:


gzip -d test.txt.gz





-d character refers to decompress or uncompressed meaning extraction pressure.

Turn off the computer run through the terminal
If you want to shut down now use the command:

shutdown -h now





If you want to shut down after 13 minutes (for example) paste the following command:


shutdown -h + 13




If you want to close the computer more specifically (at the time in Doe Doe minute) So it was used the following command:



sudo shutdown -h 21:30

* You will be closed device at time (half past nine 21:30), and you can change it to whatever you want.

تعليقات

المشاركات الشائعة من هذه المدونة

😚😚kayfiat taqbil li'awwal😘 marrat w ma fawayiduh😘😘😘😘