I would like to summarize frequently used Linux commands by genre. Environment: CentOS
# ▽ clear [Overview] Clear screen [Tips] [Control] + [L] is also possible)
clear
# ▽ pwd (print working directory) [Overview] Display the current directory path
pwd
# ▽ cd (change directory) [Overview] Change directory
cd # Change to the home directory of the currently logged in user
cd-# Return to the previous directory
cd .. # Move up one level
cd / etc / ssh # Move by specifying the path
# ▽ history [Overview] View the history of commands.
history
Execute the 30 commands displayed in the execution result of! 30 # history
Execute the 254 commands displayed in the execution result of! 254 # history
# ▽ date [Overview] Display the current date and time
date # => Sat Aug 12 08:50:30 JST 2017
date +%Y/%m/%d # => 2017/08/12
date +"%Y %m %d %H %M %S" # => 2017 08 12 08 50 30
date +"%Y-%m-%d %H:%M:%S" # => 2017-08-12 08:50:30
# ▽ cal [Overview] Display the calendar
The calendar of the cal # command execution month is displayed.
cal 2020 # 2020 calendar is displayed
# ▽ id [Overview] Display user information
id # Display information about the logged-in user
id apache # apache Show user information => uid = 48 (apache) gid = 48 (apache) groups = 48 (apache)
id hogehoge # hogehoge Display user information => uid = 1000 (hogehoge) gid = 1000 (hogehoge) groups = 1000 (hogehoge)
# ▽ useradd [Overview] Add a user [Tips] Must be executed by a user with administrator privileges
useradd hogehoge # hogehoge Add a user
cat / etc / passwd | grep hogehoge # Confirm
# ▽ passwd [Overview] Set and change user passwords
passwd hogehoge # hogehoge Change user password
passwd -S hogehoge # hogehoge Check user status
# ▽ usermod [Overview] Change user settings [Tips] Must be executed by a user with administrator privileges
usermod -L hogehoge # hogehoge Lock user
passwd -S hogehoge # Confirm => ... (Password locked.)
usermod -U hogehoge # hogehoge Unlock user
passwd -S hogehoge # Confirmation => ... (Password set, SHA512 crypt.)
usermod -G wheel hogehoge # hogehoge Add a user to the wheel group
# ▽ userdel [Overview] Delete a user
userdel hogehoge # hogehoge Delete user
userdel -r hogehoge # hogehoge Delete a user. Delete your home directory as well
Recommended Posts