[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


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


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


mv source file move destination file
option option説明
-i Confirm when carrying out the process
-f Forcibly execute the process

[** rm **]: Delete file


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


cat file name
option option説明
-n Display with line numbers added

[** less **]: View file contents using pager


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


find path-name file name

[** help **]: How to use help



[** man **]: How to use the manual


man command name
option option説明
-k word Output a list of entries containing words

[** touch **]: Change file timestamp


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


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


diff [option]File 1 File 2
option option説明
-c Output difference in context diff format
-u Output difference in unified diff format

Recommended Posts

[Linux] File and directory operation commands
Linux file and directory permissions
[Linux] Frequently used Linux commands (file operation)
Linux command [File operation]
[Linux] Zip file compression and decompression commands [Vim]
Device and Linux file system
Basic knowledge of Linux and basic commands
Linux commands
Linux study session 2nd: File operation
linux commands
Linux commands
Linux commands
[Linux] Frequently used Linux commands (folder operation)
Note: Linux concepts and minimum commands
Linux (for users and su / sudo commands)
Replace the directory name and the file name in the directory together with a Linux command.
Network Linux commands
Linux directory structure
Verbalize Linux commands
Linux [directory command]
Linux user commands
New Linux commands! !!
Basic LINUX commands
[Linux] File search
Linux directory hierarchy
Various Linux commands
Typical Linux commands (7)
[Samba] File sharing between Linux and Windows machines
OS and Linux distribution
Linux (about directory path)
[Python] File / directory operations
Beginners! Basic Linux commands and how to use them!
Maintain directory structure on Linux and move old files
Frequently used Linux commands
Frequently used Linux commands
Frequently used linux commands
[Linux] Group related commands
Linux commands to remember
Hack Linux file descriptors
New Linux commands! !! Part 2
Python directory operation summary
Linux Study Session 1st: Virtual Console and File Manipulation
Linux: files and directories
Linux Study Group 5th: Directory Manipulation, Links and Inodes
Explanation of package tools and commands for Linux OS
Linux operation on Win10
Commands and files to check the version of CentOS Linux
datetime and file write and backup
Read and write csv file
CLI and Linux basic terms
Linux (about files and directories)
About LINUX files and processes
Recording and playback on Linux
Read and write a file
File access under the directory
Django installation and operation check
Write and read a file
[Linux] Directory under the root
Basic commands for file operations
Organize [Django] commands and roles
Meaning of Linux directory permissions