Category: CLI

Using cp Command without Interaction

There’s a reason why cp is aliased to cp -i in _root’s_ .bashrc and .cshrc/.tcshrc. After all, do you really want root to be able to overwrite a file without checking? There is a way around the problem that retains the copy protections in root’s shell. Here’s how: \cp -f Backslashing the command temporarily avoids…


Which physical interface is eth0?

This blinks the LED on the interface for five seconds–without interrupting network traffic. ethtool -p eth0 5 supported only by the following drivers: ewrk3 s2io sky2 tg3 e100 pcnet32 bnx2 skge e1000 sk98lin ixgb


How do I capture the output of “top” to a file?

This will run top once write the output to a file and exit. The command top can also be run so that it will give multiple reports. top -b -n1 > /tmp/top.txt To run top 5 times and wait 5 seconds between each output the command would be: top -b -n5 -d5 > /tmp/top.txt


Kick all users other than you from your box and keep them out.

watch -d ‘w | awk ‘NR==4 {print “/dev/”$2}’ | xargs fuser -k’


Watch a Process

Watch will run the specified command repeatedly (by default, every two seconds) and display the output so you can watch it change over time. watch -d -n 15 ps auxf | grep cpbackup -d differences -n 15 =#seconds