User Tools

Site Tools


info:basic_commands

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
info:basic_commands [2009/12/03 16:21] moritzinfo:basic_commands [2011/07/22 13:10] – [HTTP/FTP] spelling moritz
Line 8: Line 8:
   * ''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'' can be used to find files. Use ''find -name \*.txt'' to find all text files in the current directory. To delete the files found, use ''find -name ... -print | xargs rm''As an alternative, use ''rm $(find -name ...)'', but this functionality depends on the shell.+  * ''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.
-  * ''cat'' reads a file and prints it to ''stdout'' (the console if invoked as-is.)+  * ''cat'' reads a file and prints it to ''stdout'' (the console if invoked as-is.) To read from STDIN, pass ''-'' as the file to read. This can be used to create a file by entering its content in the console. Use ''cat - > new_file'' and paste the content to quickly create a new file with content. To end the file, press Ctrl+D, which produces the EOF-character.
   * ''locate'' locates all files that contain a given string.   * ''locate'' locates all files that contain a given string.
   * ''grep'' searches input for matching lines. To search all files in the current directory (and sub directories), use ''grep -r . -e "text"''.   * ''grep'' searches input for matching lines. To search all files in the current directory (and sub directories), use ''grep -r . -e "text"''.
   * ''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 PDFs referenced by the HTML file.
 +
  
 ===== Piping ===== ===== Piping =====
info/basic_commands.txt · Last modified: 2012/02/25 21:10 by hartmut

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki