Linux commands: Difference between revisions

Jump to navigation Jump to search
580 bytes added ,  12 July 2014
→‎file operation: add switch to my home directory
(→‎file operation: add switch to my home directory)
Line 52: Line 52:
** mkdir ''new_dir''
** mkdir ''new_dir''
** cp ''old_dir/* new_dir''
** cp ''old_dir/* new_dir''
=== download file from remote server ===
* FTP
* wget (with progress bar): {{kbd | key= <nowiki>wget http://path.to/file</nowiki>}}
* SVN update: {{kbd | key= <nowiki>svn up http://remote.svn.server/path/ /local/path/ --username=your_account</nowiki>}} and key in your SVN password <ref>using the www account {{kbd | key= <nowiki>su - www -c "svn up http://remote.svn.server/path/ /local/path/ --username=your_account --password=xxx" </nowiki>}}</ref>
* more on [[File transfer methods]]


=== delete files or directory ===
=== delete files or directory ===
Line 73: Line 67:
* S/FTP to the server and delete selected files
* S/FTP to the server and delete selected files


=== rename (move) files or directory ===
 
* {{kbd | key=mv ''old_folder_name new_folder_name''}} ({{Linux}})<ref>[http://www.liamdelahunty.com/tips/linux_rename_directory.php Linux Rename Files, Folders or Directories]</ref>
=== download file from remote server ===
* {{kbd | key=mv ''/path/to/file /path/to/new_folder_name''}} ({{Linux}})
* FTP
* {{kbd | key=rename ''old_folder_name new_folder_name''}} ({{Win}})<ref>[http://www.computerhope.com/renamehl.htm MS-DOS ren and rename command help]</ref>
* wget (with progress bar): {{kbd | key= <nowiki>wget http://path.to/file</nowiki>}}
* SVN update: {{kbd | key= <nowiki>svn up http://remote.svn.server/path/ /local/path/ --username=your_account</nowiki>}} and key in your SVN password <ref>using the www account {{kbd | key= <nowiki>su - www -c "svn up http://remote.svn.server/path/ /local/path/ --username=your_account --password=xxx" </nowiki>}}</ref>
* more on [[File transfer methods]]
 
 
=== file compression and decompression ===
compress
* {{kbd | key= <nowiki>pv big.file | gzip > big.file.gz</nowiki> }}({{Linux}})<ref>[http://www.catonmat.net/blog/unix-utilities-pipe-viewer/ A Unix Utility You Should Know About: Pipe Viewer - good coders code, great reuse]</ref> keep the original file
* {{kbd | key= gzip -v big.file}}({{Linux}}) NOT keep the original file
 
decompress
* {{kbd | key= gunzip -c big.file.gz > big.file}}({{Linux}}) keep the gz file<ref>[http://superuser.com/questions/45650/how-do-you-gunzip-a-file-and-keep-the-gz-file linux - How do you gunzip a file and keep the .gz file? - Super User]</ref>
* {{kbd | key= gzip -d big.file.gz}}({{Linux}}) NOT keep the gz file
 


=== list directory or files /  list directory contents ===
=== list directory or files /  list directory contents ===
Line 86: Line 93:
* {{Gd}}  create ls in {{Win}} command prompt: {{kbd | key = echo dir %1 > %systemroot%\system32\ls.bat}} Thanks, hmjd!<ref>[http://stackoverflow.com/questions/9362692/how-to-create-ls-in-windows-command-prompt How to create ls in windows command prompt? - Stack Overflow]</ref>
* {{Gd}}  create ls in {{Win}} command prompt: {{kbd | key = echo dir %1 > %systemroot%\system32\ls.bat}} Thanks, hmjd!<ref>[http://stackoverflow.com/questions/9362692/how-to-create-ls-in-windows-command-prompt How to create ls in windows command prompt? - Stack Overflow]</ref>


=== show the current directory ===
 
=== rename (move) files or directory ===
* {{kbd | key=mv ''old_folder_name new_folder_name''}} ({{Linux}})<ref>[http://www.liamdelahunty.com/tips/linux_rename_directory.php Linux Rename Files, Folders or Directories]</ref>
* {{kbd | key=mv ''/path/to/file /path/to/new_folder_name''}} ({{Linux}})
* {{kbd | key=rename ''old_folder_name new_folder_name''}} ({{Win}})<ref>[http://www.computerhope.com/renamehl.htm MS-DOS ren and rename command help]</ref>
 
 
=== show the current directory / where am i ===
* {{kbd | key= pwd}}({{Linux}})
* {{kbd | key= pwd}}({{Linux}})
* {{kbd | key= echo %cd%}}({{Win}}) <ref>[http://stackoverflow.com/questions/921741/windows-equivilent-to-unix-pwd Windows equivilent to UNIX pwd - Stack Overflow]</ref>
* {{kbd | key= echo %cd%}}({{Win}}) <ref>[http://stackoverflow.com/questions/921741/windows-equivilent-to-unix-pwd Windows equivilent to UNIX pwd - Stack Overflow]</ref>


=== file compression and decompression ===
compress
* {{kbd | key= <nowiki>pv big.file | gzip > big.file.gz</nowiki> }}({{Linux}})<ref>[http://www.catonmat.net/blog/unix-utilities-pipe-viewer/ A Unix Utility You Should Know About: Pipe Viewer - good coders code, great reuse]</ref> keep the original file
* {{kbd | key= gzip -v big.file}}({{Linux}}) NOT keep the original file


decompress
=== switch to my home directory ===
* {{kbd | key= gunzip -c big.file.gz > big.file}}({{Linux}}) keep the gz file<ref>[http://superuser.com/questions/45650/how-do-you-gunzip-a-file-and-keep-the-gz-file linux - How do you gunzip a file and keep the .gz file? - Super User]</ref>
* {{kbd | key= cd ~/}} or {{kbd | key= cd $HOME}} ({{Linux}}) will switch to my home directory ex: /Users/ACCOUNT<ref>[http://superuser.com/questions/271925/where-is-the-home-environment-variable-set linux - Where is the $HOME environment variable set? - Super User]</ref>
* {{kbd | key= gzip -d big.file.gz}}({{Linux}}) NOT keep the gz file
* {{kbd | key= cd %UserProfile%}} ({{Win}}) will switch to my home directory ex: C:\Users\ACCOUNT more on [[MS_Windows_Explorer]]<ref>[http://weka.wikispaces.com/Where+is+my+home+directory+located%3F weka - Where is my home directory located?]</ref>


== network ==
== network ==

Navigation menu