linux tips


info coreutils


  • try to open manual pages for programs or configuration files you want to learn about
  • example: man locale.conf

bash configuration

file: .bashrc

# more than 16 colors on the terminal
export TERM=xterm-256color

# set at new magenta colored prompt that uses a separate line, indents the executed command line and shows the current working directory
# example:
# previous-command-stuff
# ----~
#   ls
# a b c d
export PS1="\e[0;35m----\W\e[m\n  "

# disable the .bash_history file that stores previously executed commands between terminal sessions - for privacy

# do not put duplicate commands in the history
export HISTCONTROL='ignoreboth:erasedups'

# like cd but calls "ls" after the current working directory has changed and "ls" output starts at the top of the terminal window
c () {
  cd $* && ls --group-directories-first --color -w 80

# like "ls" but always starts output from the top of the terminal window and displays the listed directory name
l () {
  echo $*:
  ls --color --group-directories-first $*


tail -f displays lines from the end of files and continues to display live future updates - so you can wait and see updates in real-time

tail -f /var/log/mylogfile

-n specifies the number of last lines to show at first

tail -n 400 -f /var/log/mylogfile

it can be filtered

tail -f |grep myfilterstring

there is more: it can display live updates of multiple files. new file updates are preceded by markers that state the source file name

tail -f /var/log/mylogfile /var/log/another-file /var/log/and-another-file

keyboard commands on the terminal

  • C+l clear
  • C+c sigint signal
  • C+d exit


see systemd

recurring task execution

cron can do it

with arch linux

su root
# dcron, one of the simpler implementations
pacman -S dcron
systemctl enable crond
# remove the included preset jobs and directories - /etc/cron.daily and the like
crontab -d && rmdir /etc/cron*
mkdir /etc/cron.d
# create rules in cron job files
nano /etc/cron.d/myscript
systemctl start crond

crond sends the standard output from jobs per mail, you may not want this so edit "/etc/conf.d/crond" and add "-m off" to the arguments. "systemctl status crond" shows log and error information

cron format

see here

example line

0 */12 * * * /usr/bin/redmine-update-repositories


  • "" means "every". so that " 3" would mean "every minute at hour 3"
  • "*/2" means "each 2"

ensuring permissions

  • create a script called "ensure-permissions" where the desired filesystem permissions are applied with commands like chmod
  • let this script run regularly. unanticipated permission changes are otherwise unlikely to be corrected