LFCS Commands

Commands needed for Linux Foundation Certified Sysadmin.

Processes

ulimit

  • man page
  • get/set the resource limits of processes
  • restrict: processes cant exhaust the system’s resource
  • expand: set enough resource to run a propgram properly
  • hard limit: the possible maximum of resource, set by root
  • soft limit: the possible maximum of resource for user, cant exceed hard limit
  • users and root has different limits
  • the settings are valid for the current shell, to modify persistent, write to /etc/security/limits.conf
  • get all limit: ulimit -a
  • set the limit of open files: ulimit -n 2048

ps

  • man page
  • show current processes
  • list all processes: ps -elf or ps -aux

nice

  • man page
  • set the starting process priority level
  • higher nice level means lower priority
  • range: -20 to 19
  • run a script with lower priority: nice -n 10 ./script or nice -10 ./script
  • run a script with higher priority: nice -n -10 ./script or nice --10 ./script

renice

  • man page
  • set an already runnning process priority level
  • increase a PID’s priority level: renice -n 10 2000 or renice +10 2000
  • lower a PID’s priorty level: renice -n -10 2000 or renice -10 2000

ldd

  • man page
  • list the shared libraries needed to a binary
  • list the shared libraries need by ls: ldd /bin/ls

ldconfig

  • man page
  • generally runs at boot time
  • used to build a cached database of shared libraries

ipcs

  • man page
  • get informations about IPC facilities
  • to list facilites with PID: ipcs -p

Signals

kill

  • man page
  • send a signal to a process
  • list signals: kill -l
  • SIGTERM is the default signal, if the number ommited
  • only accept PID!
  • kill process using number: kill -n 9 2000 or kill -9 2000
  • kill process using name: kill -s SIGKILL 2000 or kill -SIGKILL 2000

killall

  • man page
  • kill all processes (those that the caller user can kill) with the given name
  • the default signal is SIGTERM
  • kill every firefox instance with number: killall -9 firefox
  • kill every firefox instance with name: killall -SIGKILL firefox

pkill

  • man page
  • send signal to a process with a criteria
  • kill very firefox instance of user g0rbe: pkill -u g0rbe firefox