A collection of commands frequently used in server management

There was a request from our young people, so I summarized it.

File related

cd
Move
directory.
``` cd /home/okuno/ ```
cat
Display the contents of the
file. Display one screen at a time with less.
``` cat access.log | less ```
tail
Display the latest 〇 items in the file. Updated in real time with the f option.
``` tail -1000 access.log | less tail -f access.log ```
vim
vi uses vim because some distributions have a traditional keyboard layout (which isn't the case these days).
``` vim /etc/apache2/httpd.conf ```
cp
Copy the
file. Often the whole copy is done with -a.
``` #Whole copy cp -a /from/* /to/ ```
mv
Move the file.
``` mv /from/file.txt /to/ ```
tar
Unzip the
file. Learn as a set with options.
``` tar zxvf hoge.tar.gz ```
rm
Delete the
file. The -f option has excellent destructive power, so refrain from executing it as root as much as possible. Relative paths are somewhat more secure.
``` #Superlative command rm -rf gomi ```
df
Check the disk capacity. Optimize display capacity with -h.
``` df -h ```
du
Check the capacity for each layer. Since it is often summarized in the first layer, copy it.
``` du --max-depth=1 -h ```
locate
Search
files fast. updatedb will create the latest database.
``` locate sagashimono.txt ```
find
Search for
files. Please note that it may take some time.
``` #Find by date find ./* -newermt '20190517 17:00' ``` ## Process management
ps
Show running processes. In many cases, ax and grep are used.
``` ps ax | grep apache2 ```
kill
Terminate the running process. I often use forced termination and restart.
``` #forced termination kill -9 [Process number] #Reboot kill -HUP [Process number] ```
uptime
Displays the current time, server operating time, number of connected users, and load status (load average).
``` uptime ```

Login relationship

last
Display login history. Display one screen at a time with more.
``` last | more ```
who
Show the currently logged in user.
``` who ```
vlock
Lock the console screen. You will need to enter the password to start again, and you can prevent mistakes while working at the same time.
``` vlock ``` ## Communication relations
ping
Simple communication confirmation.
``` ping ww-system.com ```
netstat
Check the communication connected to the server.
``` netstat ```
traceroute
Check the communication path.
``` traceroute ww-system.com ```
dig
Check DNS.
``` #When specifying a DNS server dig @localhost ww-system.com ```
nslookup
Check DNS. Part 2. mx Used when checking records.
``` nslookup >set type=mx >ww-system.com >Exit with exit ```
mail
Confirm the sending of the email.
``` mail [email protected] Subject:test [Ctrl + D] Cc:[Enter] Null message body; hope that's ok sends a simple email with a blank body ```
wget
Get the file from an external server.
``` wget https://hogefuga.loc/piyo.tar.gz ```
iptable
Implement a firewall with software. There are many IP denials. Recent Debian is managed by ufw, so use it conveniently.
``` #Deny IP iptables -I INPUT -s ***.***.***.*** -j DROP ``` ## Package management
systemctl
Start / stop the service.
``` systemctl start apache2 ```
cpan
Perl module management. Recently, the number of modules that can be managed by yum has increased.
``` cpan ```

Recommended Posts

A collection of commands frequently used in server management
Summary of frequently used commands in matplotlib
[Linux command] A memorandum of frequently used commands
Frequently used commands in virtualenv
A collection of code often used in personal Python
A collection of Excel operations often used in Python
Display a list of frequently used commands on Zsh
8 Frequently Used Commands in Python Django
List of frequently used Linux commands
[Anaconda3] Summary of frequently used commands
[Python] A memo of frequently used phrases (by myself) in Python scripts
[Linux] Review of frequently used basic commands 2
[Linux] Review of frequently used basic commands
[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)
pyenv Frequently used commands
Frequently used tmux commands
Frequently used Linux commands
Frequently used Linux commands
Frequently used linux commands
Frequently used pip commands
A collection of Numpy, Pandas Tips that are often used in the field
Python scikit-learn A collection of predictive model tips often used in the field
Python scikit-learn A collection of predictive model tips often used in the field
[For beginners] Django Frequently used commands and reference collection
A memorandum of commands, packages, terms, etc. used in linux (updated from time to time)
Frequently used subpackages of SciPy
A collection of methods used when aggregating data with pandas
Can be used with AtCoder! A collection of techniques for drawing short code in Python!
[Linux Nginx] Command collection used for initial setting of Web server
Linux Frequently Used Commands [Personal Memo]
A collection of one-liner web servers
[Linux] Frequently used Linux commands (file operation)
Frequently used Linux commands (for beginners)
A class that summarizes frequently used methods in twitter api (python)
[Linux] Frequently used Linux commands (folder operation)
[Python/Django] Summary of frequently used commands (4) -Part 2- <Production operation: Amazon EC2 (Amazon Linux 2)>
Commands often used in the terminal (EC2 server) (for your own viewing)
[Python/Django] Summary of frequently used commands (4) -Part 1- <Production operation: Amazon EC2 (Amazon Linux 2)>
Modules of frequently used functions in Python (such as reading external files)
A memorandum of filter commands that you might forget in an instant
Generate a first class collection in Python
Summary of methods often used in pandas
Disk-related commands often used in Ubuntu (memories)
Display a list of alphabets in Python 3
[python] Frequently used techniques in machine learning
Sum of variables in a mathematical model
[Machine learning] List of frequently used packages
A personal memo of Pandas related operations that can be used in practice
A memorandum of method often used in machine learning using scikit-learn (for beginners)
Set up a simple HTTPS server in Python 3
Draw a graph of a quadratic function in Python
List of frequently used built-in functions and methods
Get the caller of a function in Python
Summary of what was used in 100 Pandas knocks (# 1 ~ # 32)
Full disclosure of methods used in machine learning
Make a copy of the list in Python
Set up a test SMTP server in Python.
Find the number of days in a month
A proposal for versioning of features in Kedro