Sunday, August 06, 2006

Simple admin commands

Here are some simple sysadmin commands:
  • To create accounts for users (the nice way), the command is adduser <user> which will create an entry in the etc/passwd file and add a home directory for that user (and probably some other stuff, too...)
  • userdel -r <user> delete accounts for users (the nice way) (-r means delete the home directory as well)
  • passwd <user> change a user's password
  • uptime tell how long a system has been running
  • du -h <file/directory> display a human-readable estimation of how much disk space something is taking
  • df -h display a human-readable report of file system disk space usage
  • ps report a snapshot of the current processes
  • ps aux (username, process ID, %CPU, %MEM, virtual memory used (pages), physical memory used, TTY, STAT (process state), date of start, time of start, command)
  • pstree display a tree of processes
  • arp display IP->MAC translation tables
  • acpi display battery status
  • shutdown -h now shut down, power down
  • uname print system information (kernel version, processor, etc)
  • whereis locate the binary, source, and manual page files for a command
  • locate find file names on the whole system FAST (if it's not finding a new file, run updatedb to update locate's index and then run locate again)
  • last -a show a listing of users that have logged into the system and from where
  • screen screen manager (very useful for doing heavy duty stuff on remote systems... see tip #7 of this post for details)
  • free -m display free and total memory in MB (RAM and swap)
  • fuser -v <file> show the user, PID, access type and command accessing of an open file (v for verbose)
  • lsof <file> for even more information than fuser
Important files/places:
  • /proc directory that contains a lot of hardware and system information

No comments: