This will be a memo for learning.
A directory is a folder. A folder that stores files. The directories are nested.
/bin
/dev
/etc
Store configuration file
The configuration file of the application that runs on Linux and the file related to the configuration of Linux itself are placed.
/home
Home directory (personal directory assigned to each Linux user) is placed
Users are free to create files and directories in their home directory
/sbin
/tmp
/usr
/var
1.cd(change directory)
cd [directory]
Command to move directory
There is a special way to specify the current directory, parent directory, and home directory.
directory | meaning | How to specify |
---|---|---|
Current directory | The directory you are currently in | 「.」 |
Parent directory | One level higher directory | 「..」 |
Home directory | 「/home/Username directory | 「~」 |
Root directory | 「/"directory | 「/」 |
2.pwd
pwd [option] #ほとんどoptionをつけることはない
Command to display the current directory (current directory) A command that tells you where you are now
3.ls
ls [option][Directory file name]
Command to display a list of files and directories Find out which folders/files are in your current directory
You can specify multiple files at once using pathname expansion
symbol | meaning |
---|---|
* | Arbitrary string |
? | Any one character |
Concrete example
#Display a list of files with the extension html
$ls *.html
index.html home.html job.html
#Show files starting with z and ending with 4 characters
$ls /bin/z???
/bin/zcat /bin/zcmp /bin/znew
ls -l View detailed information about the file
ls -a Show all files, including hidden files
ls -F Show file type
4.mkdir(make directory)
mkdir [option]<Directory name to create>
Command to create a directory
-p Create deep directories at once With the -p option, you don't have to create a directory called test, 2019 in advance.
$mkdir -p test/2019/08
5.rmdir(remove directory)
rmdir <Directory name>
Command to delete an empty directory (an error will occur if you try to delete a non-empty directory) I rarely use it (mostly I use the rm command)
The path is the address information of a directory or file. Represent the directory hierarchy delimiter with "/"
The absolute path is the path starting from the root directory ("/").
/home/kume/code/README.md
Relative path is the path starting from the current directory.
code/README.md
Display help messages for commands with the --help
option
<command> --help
#Concrete example
ls --help
Usage: ls[option]...[File]...
It will give you an overview of how to use the command, a list of available options, and use it when you want to understand the outline of the command.
Display the command manual with the man command It's more detailed than the --help option, so use it when you want to understand the command properly.
man <Command name you want to look up>
#Concrete example
man ls
NAME
ls -list directory contents
#You can search by keyword
man -k move
Recommended Posts