Forgetful CLI

by Scott, Revised on July 31, 2017 (Linux)

Linux commands that I have a hard time remembering:

Soft links

ln -s /existing/directory/or/file /new/directory/or/file

Uncompress a file (tar gzip, tar bzip2, and tar)

tar -zxvf files.tar.gz
tar -jxvf files.tar.bz2
tar -Jxvf files.tar.xz
tar -xvf files.tar
  • z - gzip compression
  • j - bzip2 compression
  • J - XZ compression
  • x - extract
  • v - verbose mode
  • f - from file

Compress a file to tar.gz (tar gzip, tar bzip2, and tar)

tar -zcvf files.tar.gz directory_of_files
tar -jcvf files.tar.bz2 directory_of_files
tar -cvf files.tar directory_of_files
  • c - compress

STDIN, STDOUT, STDERR

These are the standard sources of input and output for a program. If numbered, then known as 0, 1 and 2. To suppress output from a program, pipe it to /dev/null and pipe STDERR to STDOUT.

>/dev/null 2>&1

See ongoing output from a log file

tail -f /path/to/log/file

Setting a date

date -s "1 JAN 2010 22:00:00"

Tags: Linux