OpenSource For You

TIPS & TRICKS

-

Stop any running process by using the command prompt

We can stop any process that is not responding by using the following method. Run the command given below to know the PID (Process ID) of the applicatio­n that you want to stop.

#top

While the above command is running, press k. This will prompt you to give the PID of the process you want to stop/kill.

PID to Kill:

You need to give the PID and press Enter to kill the process. After you have done that, press q to exit back to the output of the top command. —Vinay Khandalkar,

wwinay@gmail.com

Get a list of logged-in users with the date and time

Using the who and cut commands, one can get the list of the logged-in users with the time and date of logging in.

# who | cut -d ““-f1,12

In the above command, we redirect the output of who to the cut command.

Who will give you the list of the logged-in users on the computer and the cut command with the -d options and a

Also -f1,11,12 output. king 2012-05-18 14:27 ntest 2012-05-18 14:27

Here it shows the username, date and time.

—Chirag K Gohel, chiragkgoh­el@gmail.com

Use the time command as a stopwatch

Open a terminal and run the following command:

~$time read

Now press CTRL + D to stop the command and view its output: ~$ time read real 0m3.000s user 0m0.000s sys 0m0.000s

Here, the real timing is the time between the start and the stopping of the command. This can be used as a stop watch to calculate timing.

The command below can be used to stop the clock using any key on the keyboard instead of CTRL+D:

time read -sn1

—Ajinkya Jiman, ajinkya.jiman@gmail.com

System calls generated by command

Here is a simple command that will give you the details of the system calls generated by a command. Open a terminal and run the following command:

~$strace -c ls >/dev/null

You can read the manual page of strace for more details on this.

—Shashank Diwan, shashankdi­wan4u@gmail.com

 ??  ??
 ??  ??
 ??  ??
 ??  ??
 ??  ??

Newspapers in English

Newspapers from India