Command to print file names from ls -l output:
ls -l | while read a b c d e f g h i ; do echo $i; done
Showing posts with label Unix. Show all posts
Showing posts with label Unix. Show all posts
Wednesday, December 22, 2010
Sunday, July 05, 2009
GDB handy commands
Multi-threaded
info threads
Signals
info signals
// To pass the signal from GDB to the process.
handle SIGINT pass
To Debug a running process using GDB
gdb
info threads
Signals
info signals
// To pass the signal from GDB to the process.
handle SIGINT pass
To Debug a running process using GDB
gdb
Saturday, October 11, 2008
timeout
Debian has an interesting command timeout:
timeout 5 tail -f /var/log/messages
If you do not have timeout package installed, perl can be used to perform the same:
perl -e "alarm shift @ARGV; exec @ARGV;" 5 tail -f /var/log/messages
Reference links:
http://michael.thegrebs.com/2008/05/27/most-awesome-command-ever/
http://www.cyberciti.biz/faq/shell-scripting-run-command-under-alarmclock/
timeout 5 tail -f /var/log/messages
If you do not have timeout package installed, perl can be used to perform the same:
perl -e "alarm shift @ARGV; exec @ARGV;" 5 tail -f /var/log/messages
Reference links:
http://michael.thegrebs.com/2008/05/27/most-awesome-command-ever/
http://www.cyberciti.biz/faq/shell-scripting-run-command-under-alarmclock/
Tuesday, August 19, 2008
Get the last column from the ls command
awk '{ printf $NF;$NF = "" ;printf " "$0"\n" }' | sort
http://www.linuxfocus.org/English/September1999/article103.html
Here is one more trick I have learned from my colleague
ls -ltr | while read a b c d e f g h file; do echo $file; done
The second technique looks much easy to me
Friday, June 27, 2008
xargs command replace string
Using xargs command with replace string
to scp files with spec pattern
ls file* | xargs -n1 -i{} scp {} root@:/dest
to scp files with spec pattern
ls file* | xargs -n1 -i{} scp {} root@
Friday, December 28, 2007
Screen Command
Unix Screen command is an indespensable command. Once you know it you cannot live without it. It is window manager. Just try it and you will find it mind blowing.
A new screen can be created using
screen.
Ctrl-A c - Create new window
Ctrl-A A - Name a window
Ctrl-A " - Show all windows.
Ctrl-A S split window.
Ctrl-A tab to move to the next window.
A new screen can be created using
screen.
Ctrl-A c - Create new window
Ctrl-A A - Name a window
Ctrl-A " - Show all windows.
Ctrl-A S split window.
Ctrl-A tab to move to the next window.
Tuesday, December 26, 2006
UNIX: Passwordless authentication
You can have passwordless authentication using the information in the given site
http://www.unixwiz.net/techtips/putty-openssh.html
http://www.unixwiz.net/techtips/putty-openssh.html
UNIX: watch command
Watch command is pretty helpful if you want to continuously view the output of a command.
example:
watch --interval=10 mpstat
This shows the output of mpstat command every 10 secs in a window.
example:
watch --interval=10 mpstat
This shows the output of mpstat command every 10 secs in a window.
Subscribe to:
Posts (Atom)