The LS command is used to display which files and folders are in the directory
Ls
Blue indicates folder White is file
Ls-r List the contents of all folders (R = recursive)
Ls-l View details including file permissions last modified time size (L for long)
Ls-a Viewing hidden files
-t sort by file last modified date
-s sort by file size
-R Reverses the result (-r-r meaning is completely different)
-H (human-readable human readable) is to convert file size to KB MB GB without calculation
File to view the type of a document
File
such as picture size type video audio information and so on
To switch directories:
[Email protected]:~ $ cd desktop/[email protected]:
File permissions
file type |
owner |
owning user group |
other users |
- |
Rwx |
r-- |
r-- |
File types have normal file (-) and directory (d)
Three different permissions for users
Readable r: Open file or use LS to view permissions under Directory
Writable W: Modify the contents of the file, create permission to delete the file
Executable x: Permission to run a file as a program or to enter a directory with a CD
(A directory only has the Execute permission to enter the read and write if it is not executed into the not go)
To change the file permissions of the relevant directives:
chmod #修改权限 chown #修改文件所属者 chgrp #修改文件所属组
Quick Input Instructions:
/bo /boot/
Command run output can be output as file redirection symbol (>)
ls >./ls. txt
You can see the Ls.txt file in the current directory.
#也可以做一个计算 then output to A.txt Echo $ ((5*5)) > A.txt
You can also output the current time and date to a file
Two >> means append text
Create a Directory
mkdir work #创建一个目录 mkdir qwq College games #创建多个目录
Create a directory you can use-V to see what happens when the command executes
mkdir -v testmkdir"test"
If you want to create a multi-level directory, use the-p option
mkdir -vp work/writing/booksmkdir"work"mkdir" work/writing"mkdir"work/writing/books "
Delete File rm
RM -Option "file name"
As with mkdir, the-v option shows what happened when it was executed (what file was deleted)
#删除多个文件 rm file1 file2 file3
#使用通配符 Delete multiple files ? represents a single character * representing multiple characters [...] Denotes any character in parentheses [^...] In addition to the characters in parentheses [a-z]a to Z-range characters [0-9]0-9 of the number RM *. jpg # Delete all files in jpg format # delete img_8474.jpg img_8475.jpg img_8476.jpgrm img_*. jpg RM Img_????. Jpg
Delete Directory
rmdir Book
If you want to delete a directory (and all of the contents) you need to add-RF option
RM -RF Books
copying and deleting files
CP copy_from copy_to #复制 mv oldname newname #移动
Update cache
sudo apt-get update
Find Packages
sudo apt-Cache Search game# If the search results are too long you can browse sudo less with less
Raspberry Pi Linux Shell