Linux [directory command]


This will be a memo for learning.

A directory is a folder. A folder that stores files. The directories are nested.

The role of the main directory







/var directory)

cd [directory]

Command to move directory

Specifying a special 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 「/」


pwd [option]   #ほとんどoptionをつけることはない

Command to display the current directory (current directory) A command that tells you where you are now

ls [option][Directory file name] 

Command to display a list of files and directories Find out which folders/files are in your current directory

Convenient path name expansion

You can specify multiple files at once using pathname expansion

Path name 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

Frequently used options

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

Frequently used options

-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)

6. Path

The path is the address information of a directory or file. Represent the directory hierarchy delimiter with "/"

Pass type

1) Absolute path

The absolute path is the path starting from the root directory ("/").


2) Relative path

Relative path is the path starting from the current directory.


7. Column (Check how to use commands)

1) help command

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.

2) man 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
    ls -list directory contents
#You can search by keyword
man -k move

Recommended Posts

Linux [directory command]
Linux command # 4
Linux command # 3
Linux command # 5
Linux command list
linux at command
[Linux] Search command
Linux directory structure
Linux command <Basic 2>
Linux directory structure
Linux server command
Linux # Command Memo 1
Linux command [read]
Linux Command Summary
[Basic] linux command
Linux [shell command]
[Linux] Command / Knowledge
My linux command
Linux directory hierarchy
Linux command <Basic 1>
Linux command collection
Linux mkdir command
Linux command basics
[Linux] Git command
Linux (command memory)
Linux (about directory path)
[Linux] Volume configuration command
Linux command cheat sheet
Linux command (sequential update)
Linux basic command memorandum
Linux command [File operation]
sshfs command directory synchronization
[Linux] Basic command summary
Linux command for self-collection
linux command error collection 1
Linux command line shortcut
linux sar command CPU usage
[Linux] tar.gz compression / decompression command
What is Linux? [Command list]
Easy df command on Linux
Linux file and directory permissions
[Linux] Directory under the root
Linux tar xz command memo
Linux Command Dictionary (for myself)
linux: create original Terminal command
[Note] Useful linux command collection
Linux command memorandum [for beginners]
Linux PC spec check command
[Linux] User / group command summary
Meaning of Linux directory permissions
[Infrastructure] Linux command, shell script collection
[Linux convenient command] Try inserting exa
Command to create Linux Live USB
[Linux] OS recovery with restore command
Completion of docker command on Linux
[Linux convenient command] Try inserting csview
Permission and ownership change command [Linux]
LINUX command [wc edition] Usage example
Linux command [ldconfig] LPIC learning memo
[linux] kill command to kill the process