Tag Archives: cli

Change the color of your Linux prompt

You can change the color of your BASH prompt to red with this command: export PS1=”\e[0;31m[\u@\h \W]\$ \e[m” To make the change permanent, create a .bash_profile in your home directory (if one isn’t already present): touch ~/.bash_profile and paste the line directly into the file. Save and close. For other colors please see the attached… Read More »

List Linux processes by CPU or Memory usage

You can use a one-string command in Linux to nicely display in CLI the processes that consume your CPU. Use ps -e -o pcpu,cpu,nice,state,cputime,args –sort pcpu | sed ‘/^ 0.0 /d’ and you will get something like this: %CPU CPU  NI S     TIME COMMAND 0.1   –   0 S 00:00:13 metacity 0.1   –   0 S 00:00:18 /usr/lib/thunderbird/thunderbird-bin 0.2   –  â€¦ Read More »

Multicolumn output with ls

If you do a ls > file.txt, the output will contain a single column of text. If you want to use multiple columns, do a ls -C > file.txt

Easy BASH command histroy

While in a Terminal session, press Ctrl+R and start typing a part of a previous command. The prompt will autocomplete the command from the bash history and you won’t need to type it all over again.