设为首页 收藏本站
查看: 442|回复: 0

[经验分享] Linux: Basic Command Introduction

[复制链接]

尚未签到

发表于 2016-2-1 09:42:00 | 显示全部楼层 |阅读模式
  1. File Name convention:
  1) All characters except '/' are regarded as legal as '/' is used for file path delimeter.
  2) Space, Tab, Backspace, @, #, $, &, (, ) and - are not recommanded to be used as file name.
  3) Do not use '.' as the first character of file name. Because file name starts with '.' is regarded as hidden file.
  4) File name is case sensitive. Linux is case sensitive.
  
  2. Basic comman format:
  1) Command -Options Params
  Eg: ls -al /etc
  1) When we have multiple options, we can put them together.
  2) . represents current folder and .. represents parent folder.
  2) Command can be categorized into two kinds:
  1) root command
  usually stored in /sbin or /usr/sbin folder with the format of binary file.
  2) user command
  usually stored in /bin or /usr/bin folder with the format of binary file.
  
  3. Command Intro:
  1) Command Name: ls
  Command Derived From: list
  Command Path: /bin/ls
  Command Permission: all users
  Command Description: show all the dirs and files in current path
  Command Syntax: ls [-ald] [file or dir]
  a: Show all files including hidden files.
  l: Show detail information
  d: Show current folder properties
  Result Sample:
  drwxrwxr-x  6 administrator administrator      4096 Aug 17 23:25 apache-maven-3.1.0
  -rw-rw-r--  1 administrator administrator   5439122 Aug 17 23:24 apache-maven-3.1.0-bin.tar.gz
  Explaination:
  1) The first letter: Means the file format.
  'd' means Directory.
  '-' means Binary file.
  'l' means soft link file.
  2) The following 9 letters: Means the authority of three kind of user.
  File owner(u) -> The user that created the file/folder. And it can also be transfered to another person.
  User group(g) -> The user group that has the right of controlling this file.
  Others(o) -> ...
  3) The digit 6 or 1 means the hard link count. Will explain later.
  4) The following 'administrator' means the owner of this file.
  5) The following 'administrator' means the belonged group of this file.
  6) The following '4096' and '5439122' means the size of this file/folder. But this is not accurate when applied with folder size.
  7) The timestamp means the file creation date or last modified date.
  
  2) Command Name: cd
  Command Derived From: change directory
  Command Path: shell imbeded command
  Command Permission: all users
  Command Description: change current directory
  Command Syntax: cd [path]
  Example:
  cd /      change to root folder
  cd ..     change to parent folder
  
  3) Command Name: pwd
  Command Derived From: print working directory
  Command Path: /bin/pwd
  Command Permission: all users
  Command Description: show current direcory
  Command Syntax: pwd
  
  4) Command Name: mkdir
  Command Derived From: make directories
  Command Path: /bin/mkdir
  Command Permission: all users
  Command Description: create new directory/folder
  Command Syntax: mkdir [dir name]
  Example:
  mkdir /test -> Make directory under the context of root folder.
  mkdir test -> Make directory under the context of current working directory.
  
  5) Command Name: touch
  Command Path: /bin/touch
  Command Permission: all users
  Command Description: create a new blank file
  Command Syntax: touch [file name]
  Example:
  touch newfile
  
  6) Command Name: cp
  Command Derived From: copy
  Command Path: /bin/cp
  Command Permission: all users
  Command Description: copy file or folder
  Command Syntax: cp  -R [source folder name] [dest folder name]
  [source file name] [source file name] ... [dest folder name] [dest folder name] ...
  Example:
  cp Test.java ..
  cp Test1.java Test2.java Test3.java ..

    7) Command Name: mv  Command Derived From: move
  Command Path: /bin/mv
  Command Permission: all users
  Command Description: move file/folder location; rename file/folder
  Command Syntax: mv [source folder name] [dest folder name]
  [source file name] [source file name] ... [dest folder name] [dest folder name] ...
  Example:
  mv Test.java Test1.java --> Rename
  mv /home/administrator/Test/Test1.java  /home/administrator/Test2.java --> Move & Rename
  mv Test Test1 --> Rename folder

  8) Command Name: rmdir
  Command Derived From: remove directory
  Command Path: /bin/rmdir
  Command Permission: all users
  Command Description: delete empty folder
  Command Syntax: rmdir [source folder name]
  Example:
  rmdir Test --> It is only applied to empty folder. So its usage is highly restricted.
  
  9) Command Name: rm
  Command Derived From: remove
  Command Path: /bin/rm
  Command Permission: all users
  Command Description: delete file or folder
  Command Syntax: rm  -r [source folder name or source file name]  -> When we remove some files, there may be a prompt that ask for confirmation.
  -f [source folder name or source file name]  -> Mean 'force delete', there is no prompt for confirmation. It benefits the automatic scription.
  Example:
  rm Test.java  --> Delete single file
  rm -r Test1    --> Delete folder that may not be empty. But there may be prompts for every single file inside this folder asking for confirmation which is annonying.
  rm -rf Test1   --> Delete folder that may not be empty.

  P.S
  1) The minimum store unit in Linux is data block with the size of 512Byte.
  But we can customize the data block size.
  
  

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-172165-1-1.html 上篇帖子: 深入理解linux内核笔记 下篇帖子: Linux: Basic Command Introduction III
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表