List all cron jobs for all users


To show the list of cronjobs you run crontab -l, which only shows the cronjobs of the current user. To list all cronjobs for all users you can write a little bash script and run it as superuser:

#List all cron jobs for all users
for user in `cat /etc/passwd | cut -d":" -f1`;
crontab -l -u $user;


Replace ^M in lines

Sometimes when editing a file which was created on a machine other then your Linux machine, each line ends up with a visible ^M (CTRL + M). To remove this at each line you can use vi. In vi you can escape a control character by preceding it with a ^V (CTRL + V). Now using the search and replace command you can easily change the ^M (CTRL + M) in all lines. Change vi to the escape mode and type
CTRL+V and CTRL+M, this will look on your screen as:

Keyboard shortcuts for Bash


The BASH shell has some build-in commandline keyboard shortcuts. Some of them might not work if you are logged in through ssh, it depends on how the keys are mapped.


Bash backward compatibility


Although most Linux distrubutions are shipped with BASH as default shell you might experience some machine's don't have the BASH shell installed but the SH shell. If you write shell scripts which will be used on several machines you might start your scripts with the indicator to use sh instead of bash for backward compatibility:


Install yum from internet on Centos 5.4

If you have ever been in the situation where you had to install packages on several CentoS 5.4 machines without having yum pre-installed and not having a local rpm source available you know it is a lot of work to download all dependency packages by hand. I created a simple bash-script to download the necessary packages to install yum by hand. Create a new file for example with the content:
  • «
  •  Start 
  •  Prev 
  •  1 
  •  2 
  •  Next 
  •  End 
  • »
Page 1 of 2


You are here: Home Howtos and FAQs Bash