The Linux Command Line

Part 1 - Learning The Shell

1 - What Is The Shell

date  --  cal

df  --  to see the current amount of free space on your disk driver 

free  --  to display the amount of free momery   

2 - Navigation

pwd
cd  --  relative path
cd ~[user_name]  --  home directory

3 - Exploring The System

ls ~ /usr  --  multiple directories
ls -l  --  long format
ls -lt  -- sort by the file's modification time
OptionDescription
-FAppend a “/” if the name is a directory.
-SSort results by file size.
-tSort by modification time.
-rReverse.
drwxr-x---   4 sty   staff    136  6  3 10:11 .android
1-3-3-3  --  access rights to the file
1  --  indicates the type of file, "/" means a regular file, "d" indicates a directory
3  --  access rights for the file's owner
3  --  for the file's group
3  --  for everyone else
file filename  --  determining a file's type 

macbook:EBooks sty$ file TLCL-16.07.pdf 
TLCL-16.07.pdf: PDF document, version 1.4
less  --  view file contents
less is more
DirectoryComments
/The root directory. Where everything begins.
/binContains binaries programs that must be present for the system to boot and run.
/bootContains the Linux kernel, initial RAM disk image, and the boot loader.
/dev“Everything is a file”.
/etcContains all of the system-wide configuration files.
/optUsed to install “optional” software. Mainly used to hold commercial software products.
/usrContains all the programs and support files used by regular users.
/usr/binContains the executable programs installed by your linux distribution.
/usr/libThe shared libraries for the programs in /usr/bin.
/usr/localWhere programs that are not included with your distribution but are intended for system-wide use are installed.
/usr/sbinContains more system administration programs.
/usr/shareContains all the shared data by programs in /usr/bin. Includes things like default configuration files, icons, screen backgrounds, sound files, etc.

4 - Manipulating Files And Directories

cp
mv
mkdir
rm
ln  -- create hard and symbolic links
wildcards
WildcardsMatches
Data???Any file beginning with Data followed by exactly three characters
[abc]*Any file beginning with either an “a”, “b”, or “c”
Backup.[0-9]Any file beginning with Backup followed by one number
[[:upper:]]*Beginning with an uppercase letter
[![:digit:]]*Not beginning with a numera
*[[:lower:]123]Ending with a lowercase letter or the numerals 1, 2, or 3
mkdir
mkdir dir1 dir2 dir3
cp
cp item... directory. -- to copy multiple items
CommandResults
cp file1 file2If file2 exists, it is overwritten with the contents of file1, if not, create file2.
cp -i file1 file2Same as above, except that if file2 exists, the user is prompted before it is overwritten.
cp file1 file2 dir1Copy file1 and fie2 into directory dir1.
cp dir1/* dir2Using a wildcard, all the files in dir1 are copied into dir2.
cp -r dir1 dir2After the copy, dir2 will contain the same contents as directory dir1.
mv
mv item1 item2  --  to move or rename file or directory item1 to item2
mv item... directory  --  move one or more items from one directory to another
rm
CommandResults
rm file1Delete file1 silently.
rm -i file1Prompt while deleting.
rm -r file1 dir1Delete file1 and dir1 and its contents.
rm -rf file1 file2^_^
ln file link  --  hard link
ln -s item link  --  symbolic link where item is either a file or a directory

To be continue

To To To.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值