252

For Nvidia GPUs there is a tool nvidia-smi that can show memory usage, GPU utilization and temperature of GPU. There also is a list of compute processes and few more options but my graphic card (GeForce 9600 GT) is not fully supported. Sun May 13 20:02:49 2012 +------------------------------------------------------+ | NVIDIA-...


151

You should consider using inotifywait, as an example: inotifywait -m /path -e create -e moved_to | while read path action file; do echo "The file '$file' appeared in directory '$path' via '$action'" # do something with the file done In Ubuntu inotifywait is provided by the inotify-tools package. As of version 3.13 (current in Ubuntu ...


151

It might suffice to use watch: $ watch tail -n 15 mylogfile.txt


77

Any user, including root, can forward their local email by putting the forwarding address in a file called ~/.forward. You can have multiple addresses there, all on one line and separated by comma. If you want both local delivery and forwarding, put root@localhost as one of the addresses. The system administrator can define email aliases in the file /etc/...


71

For linux, use nvidia-smi -l 1 will continually give you the gpu usage info, with in refresh interval of 1 second.


63

Recently I have written a simple command-line utility called gpustat (which is a wrapper of nvidia-smi) : please take a look at https://github.com/wookayin/gpustat.


62

From the tail(1) man page: With --follow (-f), tail defaults to following the file descriptor, which means that even if a tail’ed file is renamed, tail will continue to track its end. This default behavior is not desirable when you really want to track the actual name of the file, not the file descrip- tor (e.g., log rotation). ...


61

psrecord The following addresses history graph of some sort. Python psrecord package does exactly this. pip install psrecord # local user install sudo apt-get install python-matplotlib python-tk # for plotting; or via pip For single process it's the following (stopped by Ctrl+C): psrecord $(pgrep proc-name1) --interval 1 --...


57

There are several aspects to this question which have been addressed partially through other tools, but there doesn't appear to be a single tool that provides all the features you're looking for. iotop This tools shows which processes are consuming the most I/O. But it lacks options to show specific file names. $ sudo iotop Total DISK READ: 0.00 B/s ...


56

I am not aware of a way using iproute2 tools. But as a workaround, you could try this one out. lsof -Pan -p PID -i should give you the information you are looking for. Output lsof -Pan -p 27808 -i COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME httpd 27808 apache 5u IPv6 112811294 0t0 TCP *:80 (LISTEN) httpd 27808 apache ...


56

You can use ss from the iproute2 package (which is similar to netstat): ss -l -p -n | grep "pid=1234," or (for older iproute2 version): ss -l -p -n | grep ",1234," Replace 1234 with the PID of the program.


55

For Intel GPU's there exists the intel-gpu-tools from http://intellinuxgraphics.org/ project, which brings the command intel_gpu_top (amongst other things). It is similar to top and htop, but specifically for the Intel GPU. render busy: 18%: ███▋ render space: 39/131072 bitstream busy: 0%: ...


51

I gave up and coded my own tool. To quote from its docs: SYNOPSIS tracefile [-adefnu] command tracefile [-adefnu] -p pid OPTIONS -a List all files -d List only dirs -e List only existing files -f List only files -n List only non-existing files -p pid Trace process id -u List ...


40

You may use tcpdump. # tcpdump filter for HTTP GET sudo tcpdump -s 0 -A 'tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x47455420' # tcpdump filter for HTTP POST sudo tcpdump -s 0 -A 'tcp dst port 80 and (tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x504f5354)' For a solution using tshark see: https://serverfault.com/questions/84750/monitoring-http-...


39

What about -sSf? From the man pages: -s/--silent Silent or quiet mode. Do not show progress meter or error messages. Makes Curl mute. -S/--show-error When used with -s it makes curl show an error message if it fails. -f/--fail (HTTP) Fail silently (no output at all) on server errors. This is mostly done to better enable ...


35

nvidia-smi does not work on some linux machines (returns N/A for many properties). You can use nvidia-settings instead (this is also what mat kelcey used in his python script). nvidia-settings -q GPUUtilization -q useddedicatedgpumemory You can also use: watch -n0.1 "nvidia-settings -q GPUUtilization -q useddedicatedgpumemory" for continuous monitoring.


29

If you have inotify-tools installed you can use inotifywait to trigger an action if a file or directory is written to: #!/bin/sh dir1=/path/to/A/ while inotifywait -qqre modify "$dir1"; do /run/backup/to/B done Where the -qq switch is completely silent, -r is recursive (if needed) and -e is the event to monitor, in this case modify. From man ...


28

You're looking for tail -f error.log (from man tail): -f, --follow[={name|descriptor}] output appended data as the file grows; -f, --follow, and --fol‐ low=descriptor are equivalent That will let you watch a file and see any changes made to it.


27

You can trace the system calls with strace, but there is indeed an inevitable speed penalty. You need to run strace as root if the command runs with elevated privileges: sudo strace -f -o foo.trace su user -c 'mycommand' Another method that's likely to be faster is to preload a library that wraps around filesystem access functions: LD_PRELOAD=/path/to/...


26

I prefer incron, as its easier to manage. Essentially it's a service that leverages inotify and you can setup configurations to take action based on file change operations. Ex: <directory> <file change mask> <command or action> options /var/www/html IN_CREATE /root/scripts/backup.sh You can see a full example here: http://www.cyberciti....


25

If you use watch, try the -n option to control the interval between each update. Thus, the following would call tail every 2 seconds $ watch -n 2 tail -n 15 mylogfile.txt while this one polls it every 1 second $ watch -n 1 tail -n 15 mylogfile.txt


24

I just cooked up this, and see no huge problems with it, other than a tiny chance of missing files in between checks. while true do touch ./lastwatch sleep 10 find /YOUR/WATCH/PATH -cnewer ./lastwatch -exec SOMECOMMAND {} \; done If your file processing doesn't take too long, you should not miss any new file. You could also background ...


24

If you have a separate server to run your check script on, something like this would do a simple Ping test to see if the server is alive: #!/bin/bash SERVERIP=192.168.2.3 NOTIFYEMAIL=test@example.com ping -c 3 $SERVERIP > /dev/null 2>&1 if [ $? -ne 0 ] then # Use your favorite mailer here: mailx -s "Server $SERVERIP is down" -t "$...


22

You're looking for strace! I found this answer on askubuntu, but it's valid for Unix: To start and monitor an new process: strace -f -e trace=network -s 10000 PROCESS ARGUMENTS To monitor an existing process with a known PID: strace -p $PID -f -e trace=network -s 10000 Otherwise, but that's specific to Linux, you can run the process in an ...


21

For checking I/O usage I usually use iotop. It's not installed by default on the distro, but you can easily get it with: sudo apt-get install iotop Then launch it with root priviledges: sudo iotop --only The --only option will show only the processes currently accessing the I/O.


20

The manpage reveals the answer. You will need tmux 1.4 (released Dec. 2010) or better. Press Ctrl+B then enter the command: :setw monitor-silence 30 To identify all quiet windows in the session, apply the setting to all windows: :setw -g monitor-silence 30


20

In Linux, you can try this: top -bn1 > output.txt From man top: -b : Batch-mode operation Starts top in 'Batch' mode, which could be useful for sending output from top to other programs or to a file. In this mode, top will not accept input and runs until the iterations limit you've set with the '-n' ...


20

Use "less" instead of "tail" for scrollback and search You can use tail -f error.log or, better: tail -F error.log. But if you want to scroll back in the file, that's not very useful. With less +F error.log you get the function of tail -f, but can interrupt the reading of new input with Ctrl+C. Then, you are in the normal less mode, where you can ...


20

Combine xtrace with PS4 inside the script: $ cat test.sh #!/usr/bin/env bash set -x PS4='+${LINENO}: ' sleep 1m sleep 1d $ timeout 5 ./test.sh +3: PS4='+${LINENO}: ' +5: sleep 1m or in the parent shell: $ cat test.sh sleep 1m sleep 1d $ export PS4='+${LINENO}: ' $ timeout 5 bash -x ./test.sh +1: sleep 1m


19

If you just want to get the number and don't need any details you can read the data from /proc/net/sockstat{,6}. Please keep in mind that you have to combine both values to get the absolute count of connections. If you want to get the information from the kernel itself you can use NETLINK_INET_DIAG to get the information from the kernel without having to ...


Only top voted, non community-wiki answers of a minimum length are eligible