[Linux] Review of frequently used basic commands

I was keenly aware of the lack of knowledge of Linux when building AWS, so I will review the basic commands again.

Directory manipulation

Basic commands used when you want to manipulate directories.

cd command

A command to move directories.

#Move to root dictator
cd /

pwd command

Display the current directory (where you are).

pwd
/Users/hukushima

ls command

A command to list in a directory.

ls
Applications				Public
Creative Cloud Files		VirtualBox VMs
Desktop					    bash

Path name expansion

You can specify multiple files at once.

ls *.html
index.html                   home.html

option

-a Show hidden files as well.

ls -a
.DS_Store			media-3-211-600x600.jpg
.localized			index.html

-l Display detailed information about the file.

ls -l
drwxr-xr-x  10 hukushima  staff     320  3 29 19:59 javascript_practice
[email protected]  1 hukushima  staff   44368  4 20 01:03 media-3-211-600x600.jpg
[email protected]  1 hukushima  staff     296  3 28 21:09 index.htm

mkdir command

A command to create a directory.

mkdir work

option

-p Create a deep directory.

mkdir -p work/test/2020

File manipulation

Commands used when you want to work with files.

cat command

A command to check the contents of a file.

cat test.txt
test
test

option

-n It also displays the line number.

cat -n test.txt
1  test
2  test

touch command

A command to create a file.

touch index.html

rm command

A command to delete a file.

rm index.html

option

-r Delete the directory as well. All the contents are completely deleted.

rm -r dir

-f Do not display a warning when deleting. Often used in combination with -r.

rm -r dir
rm -rf dir

mv command

Commands for moving and renaming files.

#File name change
#Before change of mv After change
mv index.html home.html
#Move files
#File name Move destination directory
mv home.html dir

cp command

Copy files and directories.

#Copy file
cp index.html new_index.html
#Copy files to directory
cp index.html dir

option

-r Copy the directory.

cp -r dir new_dir

ln command

Command to paste a link. It's a shortcut in Windows.

Hard links and symbolic links

Hard link

Give multiple names to the actual state of one file. It does not disappear even if it is deleted. But an image that I don't use much.

ln file_a file_b

Symbolic link

With Windows shortcuts. It is connected to the linked file.

ln -s file_a file_c

find command

A command to find a file or directory.

#find Search start directory Search condition Search action
find . -name index.html -print

You can also use wildcards.

Summary

For the time being, I think I often use commands around here. Although it is the basic of the basics, it is called Fukane Koji, the source of drinking water. Since the basics are important for everything, I would like to thoroughly operate commands while waiting at home.

See you soon.

Recommended Posts

[Linux] Review of frequently used basic commands 2
[Linux] Review of frequently used basic commands
List of frequently used Linux commands
Frequently used Linux commands
Frequently used Linux commands
Frequently used linux commands
[Linux command] A memorandum of frequently used commands
Basic knowledge of Linux and basic commands
Linux Frequently Used Commands [Personal Memo]
Frequently used Linux commands (for beginners)
[Anaconda3] Summary of frequently used commands
[Linux] Frequently used Linux commands (folder operation)
Basic LINUX commands
Summary of frequently used commands of django (beginner)
Summary of frequently used commands in matplotlib
[Linux] List of Linux commands used in practice
Frequently used tmux commands
Frequently used pip commands
[Linux] Review of commands for deploying on AWS
[Python/Django] Summary of frequently used commands (3) <Operation of PostgreSQL>
[Python/Django] Summary of frequently used commands (2) <Installing packages>
Summary of frequently used commands (with petit commentary)
[Python/Django] Summary of frequently used commands (4) -Part 2- <Production operation: Amazon EC2 (Amazon Linux 2)>
[Python/Django] Summary of frequently used commands (4) -Part 1- <Production operation: Amazon EC2 (Amazon Linux 2)>
A collection of commands frequently used in server management
Frequently used subpackages of SciPy
Frequently used commands in virtualenv
Display a list of frequently used commands on Zsh
8 Frequently Used Commands in Python Django
About Linux commands Super basic edition
Linux commands
Linux commands
linux commands
Basic commands
Linux commands
Linux commands
[Linux] Summary of middleware version confirmation commands
Basic usage of Btrfs on Arch Linux
Summary of petit techniques for Linux commands
[Linux] Learn the basics of shell commands
[Machine learning] List of frequently used packages
[Linux] Basic settings after OS installation of CentOS 7.3
Network Linux commands
Linux command <Basic 2>
Verbalize Linux commands
List of frequently used built-in functions and methods
Review of exceptions
Linux user commands
[Basic] linux command
New Linux commands! !!
This is the only basic review of Python ~ 1 ~
This is the only basic review of Python ~ 2 ~
Frequently used methods of Selenium and Beautiful Soup
Summary of frequently used Python arrays (for myself)
Linux command <Basic 1>
This is the only basic review of Python ~ 3 ~
Selenium webdriver Summary of frequently used operation methods
Various Linux commands
Typical Linux commands (7)
A memorandum of commands, packages, terms, etc. used in linux (updated from time to time)
[Linux] A list of Linux commands that beginners should know