30 Linux Beginner Commands
$ su -
<root password>
$ visudo
root ALL=(ALL) ALL
<username> ALL=(ALL) ALL
- ls [-lahr]. List contents of current directory. [-l] to list information about files, folders. [-a] to list hidden ones. [-hr] to print file sizes in KB and MB instead of bytes.
- pwd. Print working directory
- cd <directory>. Change directory to <directory>.
- pushd <directory>. Change directory to <directory>, but revert to current on popd.
- popd. Change to previous directory saved by pushd.
- grep [-R] <pattern> <file>. Print lines matching <pattern> in <file>. [-R] to search in subdirectories recursively.
- sudo <command>. Perform <command> as super-user.
- su -[p]. Switch to super-user mode (ie. root). The [p] preserves current working directory amd does not cd to /root.
- lsof [<device>]. List open files on <device>.
- updatedb. Update the search database.
- locate <file/directory>. Locate files in / using the database created by updatedb.
- mv <source> <destination>, Move a <source> to <destination>. <source> and <destination> may also be directories. Can also be used to rename files.
- rm [-rf] <file/directory>. Remove <file/directory> forever. <directory> removed must be empty or [-r] must be specified. [-f] removes without confimation, especially useful when removing multiple files/directories.
- chmod <permissions> <file/directory>. Change permissions of <file/directory>. <permissions> may be specified as +/- r/w/x for enable/disable read/write/execute or simply a three digit number.
- mkdir <directory>. Makes <directory>
- man <command>. Displays the manual of command describing usage and features of the command. Also used to refer to programming manuals (eg. man stdio) if installed.
- ps [aux]. List processes along with process IDs. [aux] to list all.
- kill [-9] <processid>. Kill process specified by <processid>. [-9] is used to instruct the process to kill itself.
- killall <processname>. Kill all processes which have the name <processname>.
- date. Displays system date/ time. Can also be used to set date/ time. Read manual for more
- cal. Displays the month's calendar highlighting current day.
- finger. Get information about all users logged onto system.
- ping <ip>. Send test packets to <ip> to verify that the <ip> exists provided the system specified by <ip> responds to the ping.
- df. Print disk space free.
- du. Print disk space used.
- tar [xvf/cvf/-] [-C <directory>] <archive> [<directories to archive>]. Extract tarball into <directory>. [x] extracts and [c] creates archive. [-] extracts to stdout.
- unzip [-d <directory>] <zipfile>. Unzip zipfile into <directory>.
- rpm -qli <package>. Display information about <package>.
- rpm -qa <package>. Query all packages for <package>.
- basename <filename> [<suffix>]. Strip directory and <suffix> from <filename>. <filename> may be a fictitious file.
page revision: 0, last edited: 01 Jan 2008 17:12