Unix Tools (@UnixTools) profile picture

Short unix tips. Have a great tip?! Want to hear tips about a specific tool? Have a question about a tool? Let me know @UnixTools!

Joined May 2012
You can use the #unix #diff command to get in terminal side-by-side text file comparisons using the '-y' option: diff -y FILE1 FILE2
On #linux/#unix use #dd/#ssh combo to copy btwn hosts (good for #backups, #VM cloning, etc): dd if=/PATH/SOURCE | ssh HOST dd of=/PATH/COPY
#nohup a #unix process (so it won't die on logout) using #disown (after it has been backgrounded, maybe using 'ctrl+z; bg'): disown -h PID#
2
Use #watch to #monitor real time file changes, command output diffs, etc. For example, to monitor a #RAID rebuild: watch cat /proc/mdstat
1
1
Get a traditional #UNIX #timestamp on #Solaris: perl -le 'print time()'
Use #tee to send output to both #stdout and #stderr: echo "The date is `date +%`D" | tee /dev/stderr
Use #tee to duplicate a file stream so output goes to both the screen and to a file: echo "The time is now `date +%T`" | tee FILENAME
1
Use #gdb (GNU Debugger) or #strace (trace system calls) to #debug an already running process: gdb -p PID; strace -p PID
3
1
Force an immediate #shutdown (no #shutdown, no syncing, may cause damage): echo 1 > /proc/sys/kernel/sysrq; echo o > /proc/sysrq-trigger
Force an immediate #reboot (no #shutdown, no syncing, may cause damage): echo 1 > /proc/sys/kernel/sysrq; echo b > /proc/sysrq-trigger
Delete the contents of a file using #stdout #redirection : > FILENAME
Copy your #ssh key to a #remote_host to enable #passwordless login: ssh-copy-id
1
1
Delete a single command from your #shell #history: history -d LINE#
Execute a command without storing it in your #shell #history: <space> COMMAND
2
1
Invoke your default #editor in #bash/#ksh/etc.: ctrl-x e #
Use #touch to create a new empty file or update the modification time of an existing file: touch FILENAME
Start a simple #file_server (serving the current directory) on the fly with $python: python -m SimpleHTTPServer
1
1