Others - wwangdev/wwangdev.github.io GitHub Wiki

#Shell Basic Command -- Others


Need to know

  • ".tar.gz": gzip format zip file

Package Management

  • apt: apt-get, apt-cache
    • apt-get: install, update, upgrade, remove, source, clean.
    • apt-cache: search, depends

Pack Files

  • pack: tar -cvf shell.tar shell/
    • -c: create
    • -v: verbose
    • -f: named file
    • -w: permission file by file
    • -z: use gzip to zip file
  • unpack: tar -xvf shell.tar shell/
    • -x: unpack

User Management

  • sudo useradd -m XXX: add a user XXX and create home directory, then use sudo passwd XXX to setup password
  • useradd -g: mark group of new user (not frequently used)
  • history N: list command history in bash of recent N
  • sudo userdel -r XXX: delete user XXX and also delete the home directory of XXX
  • usermod:
    • -d: modify home directory
    • -e: effective date (MM/DD/YY)
    • -g: modify group
    • -l: modify user name
    • -s: modify default shell

Process Control

  • ps -aux | less
  • ps -lax | less: includes PPID and NI
  • top: realtime process monitor
  • lsof XXX: XXX is currently used by which process
  • kill XXX: try to kill a process
  • sudo kill -KILL pid: force kill
  • nice -n num XXX: increase nice level of num to XXX. No -n means 10. (nice level: -20 ~ +19)
  • renice num -p XXX: set nice value of pid:xxx to num
  • nice: list nice value