Commands
Commands
md 5/15/2022
Linux commands
Basic
cd -> change dir
Dir/file info
Dir
Make dir
mkdir dirname -> make a dir
mkdir {dir1, dir2, dir3, ...} -> make multiple dir
Remove dir
rm dirname -> remove a dir
rm -r dirname -> safe to rm a dir
rm -r dir1 dir2 dir3 .. -> remove multiple dir at a time
File manipulation
1/4
commands.md 5/15/2022
Terminal
System manipulation
sudo halt
sudo reboot
sudo shutdown -P +10 -> "shutdown the system in 10 minutes"
sudo shutdown -c -> cancel the shutdown
sudo shutdown -r +10 -> "restart the system in 10 minutes"
sudo shutdown now -> shutdown the system immediately
System Info
Server Info
hostname
hostname -I
Editor
Mail (problem)
Searching
locate -i hello -> find all file has name with "hello"
find . -type d/f -> find all dir/files in current dir
2/4
commands.md 5/15/2022
find ~ -name/-iname 'f*' / '*f' -print -> return all files name starting/ending with 'f'
(name:case-sensitive, iname:case-insesitive)
find ~ -mtime -1/1 -print -> All changed files in lastDay/more than 1 day
find ~ -mtime +1 -mtime -5 -print -> All changed files in between 1 to 5 days
find ~ -size 10k/M/G -print -> size of 10kb/10mb/10gb in home dir
find ~ -exec wc -w {} ; -print
find / -name core –exec rm {} ; -> remove core files
find -empty -> all files with no content
snap find appName -> show the result of corresponding app name
Permission/User access
0 no no no
1 no no yes
2 no yes no
3 no yes yes
4 yes no no
5 yes no yes
6 yes yes no
Intermediate
Upgrade/Update system
3/4
commands.md 5/15/2022
Crontab
Networking
4/4