Basic Commands
Basic Commands
du -csh myfolder : show how much space is in use by the folder myfolder
cd : change directory
cp -r : copy a file
rm -r : delete a file
Hard drives
Main article: hard drive commands
NetWorking
Main article: Network commands
Similarly, "||" means to execute the second command only if the first returns a nonzero exit code (i.e., it fails).
$ cd /bing 2>/dev/null || echo 'I kinna do it, Cap'\''n!'
This will cd to the directory named "bing" if it in fact exists and the command will
exit. Since it probably doesn't, being a typo, the second command will execute and
print a somewhat more entertaining error message than is usual.
Learning about commands with local documentation
A Linux system should have documentation in the form of man pages and possibly
GNU info pages (see also texinfo). In a manner similar to this page's alphabetical
list, if you know the command you wish to learn more about,
$ man command
will show you the manual page of command.
If you do not know the command but would like to see commands relevant to a
topic, use
$ apropos subject
or
$ man -k subject
to find suitable commands.
Unfortunately, while most man pages will be informative and complete, many GNU
utilities distribute very sketchy man pages whose primary purpose is to redirect the
user to the info system. In that case,
$ info command
will invoke that system of documentation.
Many commands have an "-h", "-H", "-help", "--help" option or some combination
thereof. Unfortunately, some commands understand other things by "-h" or "-H" so
unexpected and possibly unpleasant results may occur.
There are also extensive miscellaneous files usually found in /usr/doc, /usr/local/doc,
/usr/src/linux/Documentation (kernel docs), and elsewhere.
Access
Man pages are monolithic and some are quite long, and it's occasionally hard to find
what you want. The tradeoff is that the man command automatically puts you in a
pager that allows you to search for specific text, usually using key bindings like vi.
This can be good if you know what to look for.
Info pages are usually subdivided, and contain some directory and hyperlink
information. The tradeoff is that you need to be at least minimally familiar with the
key bindings used for navigation. They are a subset of those for emacs.
Alternatively, you can export the entire tree as a single text document and view
through a pager with the command
$ info --subnodes command | less
this loses the hyperlinks, but you can use the same navigation skills you use on a
man page.
Lists of commands
In our Category Command you will find all commands in this wiki, but without
explanation. The next chapter lists the most relevant ones with a short explanation
so you can decide if the respective command is right for you. If you add to this list,
your contribution should be didactic, understandable for newcomers, focused on the
"real world" and contain sensible examples.
By name
This is a list of commands that gives you just enough information to decide what
command you want to use.
A
alias - allows you to create shorter or more familiar names for commonly
used commands
awk - print only the nth word of an input line and more
bash - a shell
cat - receive strings from stdin or a file and output them to stdout or a file
cd - change to directory
cp - copy a file
disown - disowns a job (removes the pid of the job). Even when the shell
exits, the job won't stop running
find - find a file depending on its name, size, change date or other attributes
less - show output in a viewer where you can scroll and search
ln - link a file
notepad - a simple text editor, good for folks transitioning to linux, provided
by wine.
rm - delete a file
su - change user
uptime - show the time since your computer was last switched on
vim - a text editor, not entirely unlike Notepad, but more powerful and
programmable.
whereis - locate the binary, source, and manual page files for a command
By category
Cryptography Commands
Directory Commands
File Commands
Kernel-commands
Managing Sessions
Programming-related Commands
Scripting
Shells
System Information
Startup/Shutdown Commands
User commands
ftp
ifconfig
ifup
ifdown
iptraf
iwconfig
ip
lsof
nmap
netstat
nslookup
ping
route
scp
showmount
smbclient
smbmount
smbumount
ssh
telnet