It will be a memo for learning.
*[]···Any <> ・ ・ ・ Absolutely
A text file is a file in which a character string is written
.
Binary files are image files, audio files, executable files
, etc.
Display the contents of the file.
cat [option]<file name>
It is often used without options.
A command that scrolls through the contents of a file. Used when viewing the contents of a long file.
less [option]<file name>
It is often used without options.
command | Contents |
---|---|
Space bar, f | Scroll on one screen |
b | Scroll down one screen |
j | Scroll down one line |
k | Scroll up one line |
q | Exit less command |
command | Contents |
---|---|
/ |
Search downwards |
? |
Search upwards |
n | Move to the next search result |
N | Go to previous search results |
Command to create an empty file
touch <New file name>
If the file name does not exist, create an empty file, and if it exists, update the time stamp.
Command to delete files and directories
rm [option]<File name to delete>
Note: If you execute the rm command, it will be deleted, not the trash can, so make sure that you can delete it before executing it.
1.-r Delete the directory as well
rm -r dir
Note: Please note that files and directories in the directory will also be deleted at once. 2.-f Do not display a warning when deleting a file. Not recommended commands
rm -f file
3.-i Check before deleting files
rm -i file
Commands for moving and renaming files
#Concrete example
mkdir dir //Create dir directory
touch file //Create an empty file
##File name change
mv file file1
##Move files
mv file1 dir/ //Move file1 into the dir directory
-i Confirm before overwriting
mv -i file file1
Command to copy files and directories
cp [option]<Original>...<Copy to>
##Concrete example
#Copy file
cp file new file
#Copy files to no directory
cp file dir
Note: Be careful as it will overwrite the destination file if it already exists.
1.-i Confirm before overwriting
cp -i file new_file
2.-r Copy directory
cp -r dir new_dir
Command to search files
find <Search start directory><Search conditions><Search action>
#Concrete example
find . -name README.md -print
Recommended Posts