Friends,
One liner script provided below, can be used to identify the duplicate files within the system. If you want to search in a partticular path, just replace it with "/tmp" provided in sample command. It will redirect all the duplicate file names into removal_list.txt which can be used to delete them.
find /tmp "$@" -type f -print0 xargs -0 -n1 md5sum sort --key=1,32 uniq -w 32 -d --all-repeated=separate sed -r 's/^[0-9a-f]*( )*//;s/([^a-zA-Z0-9./_-])/\\\1/g;s/(.+)/#rm \1/' >> removal_list.txt
A unique blog for Unix, Linux based Tips, tricks and Shell Scripts. This is intended to be one-stop Information Center for all your Unix, Linux needs.
Wednesday, May 6, 2009
Performance comparision
Checkout the "time" command.
For checking the time taken for execution of any command do the following:
Say you want to execute "ls -l grep sanju.txt" and measure time taken for this.
Now open a bash shell and on the prompt
$time ls -l grep sanju.txt
it shows you the time taken by the command execution
For checking the time taken for execution of any command do the following:
Say you want to execute "ls -l grep sanju.txt" and measure time taken for this.
Now open a bash shell and on the prompt
$time ls -l grep sanju.txt
it shows you the time taken by the command execution
Tuesday, May 5, 2009
Unaliasing in BASH
Unaliasing in BASH
How can we unalias a command temporarily without using unalias command ?
just put the escape character before the command i.e. "\"e.g. :-
$\ls
It will show the without alias.
Thursday, January 22, 2009
How to count a particular word in VI?
If you want to count a particular word, say PROG, in a file, try this trick
:1,$s/zebra/&/g
or
if you want to count all words in a file, try
g [ctrl-g] at command mode
source: http://www.vim.org/tips/tip.php?tip_id=689
:1,$s/zebra/&/g
or
if you want to count all words in a file, try
g [ctrl-g] at command mode
source: http://www.vim.org/tips/tip.php?tip_id=689
Some useful commands
df : report disk free space
gview : load VIM, improved vi editor
history : display a list of previous commands
!! : repeat previous command
ls -p grep "/" : list sub-directories in the current directory
touch file.ext : create a NULL file named 'file.ext'
vmstat : virtual memory status
uname : system information
gview : load VIM, improved vi editor
history : display a list of previous commands
!! : repeat previous command
ls -p grep "/" : list sub-directories in the current directory
touch file.ext : create a NULL file named 'file.ext'
vmstat : virtual memory status
uname : system information
How to kill a hanged/freezed application ?
Have you ever faced a hanged/freezed application while working at GUI of linux/sun etc?
If yes, this topic is for YOU.
Xkill is a utility for forcing the X server to close connections to clients. This program is very dangerous, but is useful for aborting programs that have displayed undesired windows on a user's screen. If no resource identifier is given with -id, xkill will display a special cursor as a prompt for the user to select a window to be killed.
We can use 'xkill' for a hard-to-kill frozen application. First, open a new terminal and type "xkill". After this your cursor will be a square-shaped.
Move to frozen findow and click.
If yes, this topic is for YOU.
Xkill is a utility for forcing the X server to close connections to clients. This program is very dangerous, but is useful for aborting programs that have displayed undesired windows on a user's screen. If no resource identifier is given with -id, xkill will display a special cursor as a prompt for the user to select a window to be killed.
We can use 'xkill' for a hard-to-kill frozen application. First, open a new terminal and type "xkill". After this your cursor will be a square-shaped.
Move to frozen findow and click.
Subscribe to:
Posts (Atom)