:% s/search text/replace with/g
Linux
Terminal prompt – L[U]nix
While browsing through the forums at ArsTechnica, I came across this posting. One of the poster had a pretty cool prompt on his terminal login screen. Here is the command he used to get that effect
| export PS1=”\n\[\e[30;1m\][\[\e[35;1m\]0\[\e[30;1m\]] \[\e[0m\]\[\e[36m\]\h\[\e[37m\]:\[\e[34;1m\]\w\[\e[30;1m\]$ \[\e[0m\e7\e[1G\e[1H\e[1K\e[30;1m[\e[33m\j\e[30;1m] [\e[32;1m\!\e[30;1m] [\e[36m\u\e[30;1m] [\e[31;1m\d\e[30;1m] [\e[35m\@\e[30;1m] [\e[0m\e[36m`uname -sr`\e[30;1m]\e8\]” |
Or if you are using Redhat, you can just edit the /etc/profile file and place the above command in it. So each time you log in to the system, you get this pretty cool prompt. I keep saying that it is cool :), but don’t give any explanation. I think a picture is due here…
For the initiated..you can come up with your own neat tricks by reading this.
head
I was asked by one of my friends, how he could get the top 10 processes in a Unix system. I knew of the usual commands “top”and “ps” and never thought of how you could just get the top 10. Interestingly there is a command called “head“. So if you wanted the top 10 processes you would use “ps -auxw | head“. “man head” returns the following
NAME
head – output the first part of files
SYNOPSIS
head [OPTION]… [FILE]…
DESCRIPTION
Print first 10 lines of each FILE to standard output. With more than
one FILE, precede each with a header giving the file name. With no
FILE, or when FILE is -, read standard input.
