Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision |
info:basic_commands [2009/12/03 15:33] – external edit 127.0.0.1 | info:basic_commands [2009/12/10 13:17] – wget moritz |
---|
* ''mv'' moves a file, where path is relative to current directory: mv [path]filename [path]filname | * ''mv'' moves a file, where path is relative to current directory: mv [path]filename [path]filname |
* ''file'' reveals what content type a file is. Use it to test if a file is text, image, binary or whatever. | * ''file'' reveals what content type a file is. Use it to test if a file is text, image, binary or whatever. |
| * ''find'' and ''rm'' can be used in combination to delete files found by ''find''. e.g. this will recursively remove all files with extension ''.txt'' in the current directory: ''find . -name \*.txt -print0 | xargs -0 rm''\\ As an alternative, it is possible to use some shell features: ''rm $(find -name \*.txt)'' |
* ''sudo'' starts a process with super user (=root) capabilities. To start a root shell, use ''sudo su''. If ''sudo'' is not installed, use ''su'' instead. It requires not the current user's password but the root password. | * ''sudo'' starts a process with super user (=root) capabilities. To start a root shell, use ''sudo su''. If ''sudo'' is not installed, use ''su'' instead. It requires not the current user's password but the root password. |
* ''less'' helps to look at what a file stores. | * ''less'' helps to look at what a file stores. |
* ''man'' shows the manual for some command. Sometimes ''info'' shows a more detailed documentation. | * ''man'' shows the manual for some command. Sometimes ''info'' shows a more detailed documentation. |
* ''dmesg'' prints kernel messages. | * ''dmesg'' prints kernel messages. |
| ===== Networking Tools ===== |
| ==== HTTP/FTP ==== |
| * Use ''wget'' to download files from HTTP and FTP. The tool allows recursive downloading, i.e. also fetch outgoing links from some HTML page. To restrict the files downloaded to a certain type (by file suffix), use the ''-A'' option: <code>wget -r http://some.host/path/to/file.html -A pdf</code> downloads all PDF's referenced by the HTML file. |
| |
| |
===== Piping ===== | ===== Piping ===== |
The output of one command can be piped into the input of another command. This is done by the pipe operator ''|''. To search kernel messages for some string, use ''dmesg | grep string''. | The output of one command can be piped into the input of another command. This is done by the pipe operator ''|''. To search kernel messages for some string, use ''dmesg | grep string''. |
| |
| Additionally, the STDOUT (1) and STDERR (2) streams can also be redirected. To redirect the STDERR output to STDOUT, use: ''command 2>&1 ...''. This can be used in combination with piping. |
| |
| |