Linux CLI Intro

From wikinotes

Shortcuts

TAB       # Autocomplete filename, program, etc
CTRL + L  # Clear Terminal Screen

Help/Manuals

apropos  <command>     # list man pages related to command
man      <command>     # show man page
<command> --help       # show brief help for params

Filesystem

pwd                       # print current working dir
mkdir -p /mnt/usb/blah    # make directories
test -d  /mnt/usb         # returns 1 if /mnt/usb exists and is directory
touch    /mnt/usb/file    # create file, if not exists
rm -rf   /mnt/usb         # recursively delete /mnt/usb and contents

df -h /mnt                # list remaining space
du -h file                # list size
ncdu  /mnt                # walk dirs by size

fdisk -l                  # list disks
mount /dev/sda1 /mnt/usb  # mount a disk-partition to /mnt/usb
umount /mnt/usb           # unmount /mnt/usb

Process Management

ps -aux                  # list running processes
top                      # watch processes, sorted by cpu/memory etc
pkill  <program>         # kill processes associated with <program>
kill   <pid>             # send SIGKILL signal to process with <pid>

free -m                  # list avail memory

Startup/Shutdown

shutdown now   # shutdown pc
reboot         # reboot

Screen Locking

physlock from cli, lock all displays, require password before logging back in

archive management

bzip2 -d filename.tar.bz2  # extract bz2
tar -xvf filename.tar      # extract tarfile
unzip    filename.zip      # extract zipfile

More Info