Bash

List all cron jobs for all users

PDF

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:

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

Tags:
 

Replace ^M in lines

PDF
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
%s/^V^M//g
CTRL+V and CTRL+M, this will look on your screen as:
%s/^M//g
Tags:
 

Keyboard shortcuts for Bash

PDF

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.

Tags:
 

Bash backward compatibility

PDF

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:

Tags:
 

Install yum from internet on Centos 5.4

PDF
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 yuminstaller.sh with the content:
 
  • «
  •  Start 
  •  Prev 
  •  1 
  •  2 
  •  Next 
  •  End 
  • »
Page 1 of 2

Search






You are here: Home Howtos and FAQs Bash