[Linux] File and directory operation commands
I decided to develop using Linux for business ...
However, I don't understand command operations, so I study from the basics (if I can't master it, my work efficiency is poor).
I want to be able to output and master it.
[** ls **]: Browse files and directories
Format
ls [option] [File]
option |
option説明 |
-a |
Output everything, including hidden files |
-l |
Output in long format |
-t |
Sort by update time and output |
-r |
Sort and output in reverse order |
[** cp **]: Copy file
Format
cp [option]Copy source Copy destination
option |
option説明 |
-i |
Confirm when carrying out the process |
-r |
Target directories |
-p |
Save the information of the original file |
[** mv **]: Move files
Format
mv source file move destination file
option |
option説明 |
-i |
Confirm when carrying out the process |
-f |
Forcibly execute the process |
[** rm **]: Delete file
Format
rm file name
option |
option説明 |
-i |
Confirm when carrying out the process |
-f |
Forcibly execute the process |
-r |
Target directories |
[** pwd, cd, mkdir, rmdir **]: Directory manipulation
command |
Description |
Supplement |
pwd |
Show current directory |
|
cd |
Change directory(Move)To do |
cd -(ハイフン)でMove前のディレクトリに戻る |
mkdir |
Create a directory |
|
rmdir |
Delete directory |
|
A symbol that represents a special directory
command |
Description |
. |
Current directory |
.. |
Parent directory |
~ |
Home directory(User's work start position) |
/ |
Root directory(Indicates the top level of the directory hierarchy) |
[** cat **]: Display file contents
Format
cat file name
option |
option説明 |
-n |
Display with line numbers added |
[** less **]: View file contents using pager
Format
less file name
option |
option説明 |
space |
Go to the next page |
b |
Return to the previous screen |
f |
Go to the next screen |
↑ |
Go to the previous line |
↓ |
Go to the next line |
/word |
wordを検索する nキーで検索結果に飛ぶ |
q |
Exit the pager command |
[** find **]: Search for files
Format
find path-name file name
[** help **]: How to use help
Format
command--help
[** man **]: How to use the manual
Format
man command name
option |
option説明 |
-k word |
Output a list of entries containing words |
[** touch **]: Change file timestamp
Format
touch [option]file name
option |
option説明 |
-t |
Specify the update time[[CC]YY]MMDDhhmm[.SS]format([]Can be omitted) |
[** head, tail **]: Get part of the file
Format
head [option]file name
tail [option]file name
option |
option説明 |
-n |
lead/Outputs the specified line from the end as standard |
-c |
lead/Outputs the specified bytes from the end as standard |
[** diff **]: Compare files
Format
diff [option]File 1 File 2
option |
option説明 |
-c |
Output difference in context diff format |
-u |
Output difference in unified diff format |