14,962
edits
| Line 27: | Line 27: | ||
== file operation == | == file operation == | ||
find a file | === find a file === | ||
* find ({{Linux}}) ex: {{kbd | key= find / -iname ''filename''}} Find the '''case-insensitive''' file name Under the path / (root folder) <ref> [http://unix.stackexchange.com/questions/32155/find-command-how-to-ignore-case Find command: how to ignore case? - Unix and Linux]; Find the '''case-sensitive''' file name Under the path / (root folder) ex: {{kbd | key= find / -name ''filename''}} ref:[http://www.codecoffee.com/tipsforlinux/articles/21.html Tips For Linux - How to find files in Linux using 'find']</ref> | * find ({{Linux}}) ex: {{kbd | key= find / -iname ''filename''}} Find the '''case-insensitive''' file name Under the path / (root folder) <ref> [http://unix.stackexchange.com/questions/32155/find-command-how-to-ignore-case Find command: how to ignore case? - Unix and Linux]; Find the '''case-sensitive''' file name Under the path / (root folder) ex: {{kbd | key= find / -name ''filename''}} ref:[http://www.codecoffee.com/tipsforlinux/articles/21.html Tips For Linux - How to find files in Linux using 'find']</ref> | ||
* dir ({{Win}}) ex: {{kbd | key= dir /s ''filename''}} <ref>[http://www.computerhope.com/issues/ch000309.htm How to find a file in MS-DOS.]</ref><ref>/S 顯示指定目錄及所有子目錄中的檔案。 (引用自 dir /? 命令說明)</ref> {{exclaim}} I have no idea to specify the file path to find the file. | * dir ({{Win}}) ex: {{kbd | key= dir /s ''filename''}} <ref>[http://www.computerhope.com/issues/ch000309.htm How to find a file in MS-DOS.]</ref><ref>/S 顯示指定目錄及所有子目錄中的檔案。 (引用自 dir /? 命令說明)</ref> {{exclaim}} I have no idea to specify the file path to find the file. | ||
copy old directory to new directory | === copy old directory to new directory === | ||
* {{kbd | key=cp -a ''old_dir new_dir/''}} ({{Linux}}) | * {{kbd | key=cp -a ''old_dir new_dir/''}} ({{Linux}}) | ||
* {{kbd | key=copy /Y ''old_dir new_dir/''}} ({{Win}})<ref> /Y 不顯示覆寫現存目的檔案的確認提示。 (引用自 copy /? 命令說明)</ref> | * {{kbd | key=copy /Y ''old_dir new_dir/''}} ({{Win}})<ref> /Y 不顯示覆寫現存目的檔案的確認提示。 (引用自 copy /? 命令說明)</ref> | ||
| Line 39: | Line 39: | ||
** cp ''old_dir/* new_dir'' | ** cp ''old_dir/* new_dir'' | ||
download file from remote server | === download file from remote server === | ||
* FTP | * FTP | ||
* wget: {{kbd | key= <nowiki>wget http://path.to/file</nowiki>}} | * wget: {{kbd | key= <nowiki>wget http://path.to/file</nowiki>}} | ||
| Line 46: | Line 46: | ||
delete files or directory | === delete files or directory === | ||
* {{kbd | key=rm -rf ''/Name_of_directory''}} ({{Linux}})<ref><nowiki>[OPTION]</nowiki> | * {{kbd | key=rm -rf ''/Name_of_directory''}} ({{Linux}})<ref><nowiki>[OPTION]</nowiki> | ||
* -r remove directories and their contents recursively; | * -r remove directories and their contents recursively; | ||
| Line 57: | Line 57: | ||
* {{kbd | key=<nowiki>rsync --delete-before -a -H -v --progress --stats /path/to/empty/folder/ /path/to/target_folder_will_be_deleted/</nowiki>}} ({{Linux}})<ref>[http://blog.sina.com.cn/s/blog_5f5a3dff0101e2tm.html Linux下使用rsync最快速删除海量文件的方法_果冻的剥壳_新浪博客]</ref> ''un-verified'' | * {{kbd | key=<nowiki>rsync --delete-before -a -H -v --progress --stats /path/to/empty/folder/ /path/to/target_folder_will_be_deleted/</nowiki>}} ({{Linux}})<ref>[http://blog.sina.com.cn/s/blog_5f5a3dff0101e2tm.html Linux下使用rsync最快速删除海量文件的方法_果冻的剥壳_新浪博客]</ref> ''un-verified'' | ||
rename (move) files or 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 ''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=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> | * {{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> | ||
list directory or files / list directory contents | === list directory or files / list directory contents === | ||
* ls ({{Linux}}) ex: {{kbd | key= ls -lh}} List detailed information of files <ref>[http://linux.vbird.org/linux_basic/0210filepermission.php 鳥哥的 Linux 私房菜 -- Linux 的檔案權限與目錄配置]</ref> <ref>[OPTION] | * ls ({{Linux}}) ex: {{kbd | key= ls -lh}} List detailed information of files <ref>[http://linux.vbird.org/linux_basic/0210filepermission.php 鳥哥的 Linux 私房菜 -- Linux 的檔案權限與目錄配置]</ref> <ref>[OPTION] | ||
* -l use a long listing format | * -l use a long listing format | ||
| Line 68: | Line 68: | ||
* dir ({{Win}}) ex: {{kbd | key= dir/s/b}} is equal to {{Linux}} {{kbd | key= find /path/to/files/ -print}} <ref>[http://superuser.com/questions/159975/making-ls-output-like-dir-b-s linux - Making ls output like dir /b /s - Super User]</ref> | * dir ({{Win}}) ex: {{kbd | key= dir/s/b}} is equal to {{Linux}} {{kbd | key= find /path/to/files/ -print}} <ref>[http://superuser.com/questions/159975/making-ls-output-like-dir-b-s linux - Making ls output like dir /b /s - Super User]</ref> | ||
show the current directory | === show the current directory === | ||
* {{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 | === file compression and decompression === | ||
compress | |||
* {{kbd | key= gzip -v big.file}}({{Linux}}) | * {{kbd | key= gzip -v big.file}}({{Linux}}) | ||
* {{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> | * {{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> | ||
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 | |||
== network == | == network == | ||