Command Explanation Format Options Example pwd Display full pathname of the current working directory. None None pwd /home/userid w Display summaries of system usage, currently logged-in users, and what they are doing. w [options] [user] Display output for one user by specifying [user] -h suppress heading -s short command -u ignore username -V version info w userid time Measures program resource use Get time in seconds Returns the time since the Epoch (01/01/70), measured in seconds time [options] command [arguments] time date Current date and time date [options] [+format][date] +format – display current date in a nonstandard format. %a abbreviated weekday %b abbrev. month name %e date %T time H:M:S format %Y four-digit year %Z time zone name date +%a %b %e %T %Y %Z Tue Sep 5 14:59:37 2000 EDT cal 12 month calendar for a given year. 1 month calendar for a given month cal [-jy][[month]year] -j Julian -m Monday day -y entire year cal 2004 > Move contents/results of the command into a text file. Operator to combine several files into a new file. command > file pwd > outfile1 cat Display the contents of a file. Combine files. Append to a file. cat [options][file] -a show all -s squeeze blanks -n number each line cat outfile1 cat ch1 ch2 >all cat note5 >> notes
shutdown Graceful shutdown. Indicates how long to wait before shutting down and whether to reboot or halt afterwards. shutdown [options] [when] -h halt the system when shutdown is complete -r reboot the system when shutdown is complete shutdown –h 5 (shutdown in 5 minutes, halt after shutdown) shutdown –r now (reboot now) useradd Create new user (must be root) useradd [options] [user] -D view defaults (/etc/login.defs & /etc/default/useradd) -g specify group -c name comment useradd –g sales –c “firstname lastname” userid Command Explanation Format Options Example userdel Delete user’s account permanently userdel [options] [user] -r remove home directory and files userdel –r userid groupadd Add a new group account groupadd [options] group -g group ID (GID) groupadd –g 919 managers groupdel Remove group from account files groupdel None groupdel managers top Information about CPU-most intensive processes currently running (frequently refreshed – 5 seconds) top [options] -c show command line -s secure mode r apply renice (priority) to a process (negative = important, positive big = less important) q quit top r 1066 (PID) 10 (new NI column changed to 10, process moves down in the list free View statistics about memory usage (RAM and swap), buffers used by the kernel free [options] -t display totals free uptime Current time, amount of time logged in, number of users logged in, system load averages uptime None uptime
ps Report on all active processes currently running on the Linux system ps [options] PID, TTY, time, CMD -u user’s name who started process ps ps [-]u xosview Displays system related (CPU usage, memory usage, swap usage, load average on X Windows system in graphical format) xosview lsmod Lists modules installed in the Linux kernel (stored as file on hard disk) lsmod /proc/modules lsmod insmod Insert/add modules to the running Linux kernel. Does NOT load dependent modules as modprobe. insmod [options] file [symbol=value…] -m output a load map -o name module insmod ne2 irq = 11 io_port = Command Explanation Format Options Example depmod Create dependency file for the modules used by modprobe to automatically load the relevant modules depmod [options] modules modprobe Add a module manually PLUS any required supporting modules modprobe [options] [modules] -l list all existing modules modprobe ne2 irq = 11 Remove a module from the kernel rmmod [option] modules -r remove all dependent modules –r ne2 grep Search file(s) for lines that match a regular expression pattern grep [options] pattern [files] -i ignore upper and lowercase distinction -c count matched lines -l list file names who | grep -i who Show who is logged in to the system who [options] [file] -H show headings -u idle times who -uH