alias la='ls -la' alias gopen='gnome-open' alias gterminal='gnome-terminal' alias ls='ls --color' PS1="\`if [ \$? = 0 ]; then echo \e[33\;40m\\\^\\\_\\\^\e[0m; else echo \e[36\;40m\\\-\e[0m\\\_\e[36\;40m\\\-\e[0m; fi\` \w> "NOTE: Make sure alias comes after PS1. PS1 is for cutom prompt.
Showing posts with label bash. Show all posts
Showing posts with label bash. Show all posts
September 02, 2011
bash alias and colorful ls
Everything below should go under ~/.bashrc
November 02, 2010
How to manipulate (copy/move/rename etc..) most recent n files under a directory
In order to list most recent n files under current directory:
n represent number of files, so should be replaced with a number; eg: 5
in order to move, copy, delete or do something with the result, this line can be fed into "cp" "mv" "rm" commands. However the format is important. This line should be in between single quotes. However not the ones near by enter on your keyboard ( ' ), use the ones under esc key ( ` ).
So here is the command line for moving top n files from one directory to another:
ls --sort-time -r | tail -n
n represent number of files, so should be replaced with a number; eg: 5
in order to move, copy, delete or do something with the result, this line can be fed into "cp" "mv" "rm" commands. However the format is important. This line should be in between single quotes. However not the ones near by enter on your keyboard ( ' ), use the ones under esc key ( ` ).
So here is the command line for moving top n files from one directory to another:
mv `ls --sort-time -r | tail -n` /home/yasemin/hebelek/
Subscribe to:
Posts (Atom)