راهنمای سریع ترمینال Linux
پیشنوشت: این نوشته یک متن آموزشی سریع در مورد ابزار یا مفهومی خاص هست. چیزهایی که در پایین میخوانید عصاره اصلی چیزی هست که باید سریعا یاد بگیرید برای استفاده از این ابزار یا مفهوم. این سری نوشتهها رو با نام WTF Course منتشر میکنم.
راهنمای سریع دستورات ترمینال Linux:
Debian/Ubuntu Only:
sudo apt update | check for update
sudo apt upgrade | will upgrade packages if update available
sudo apt install [appname]
sudo apt remove [appname]
sudo dpkg -i file.deb
sudo apt autoclean && sudo apt autoremove | will clean unnecessary packages
Basic:
sudo [command] | execute command with root privileges
use Tab for command autocompletion
Ctrl+C | break and exit from currently running process/command
clear | will clear current terminal content
source filename | reload file (usually for linux config files)
alias a=“clear” | make your own command and shortcuts (a = clear)
Note: need to put aliasses in ~/.bashrc for permanent effect [need to refresh with 'source ~/.bashrc' command]
| (pipe) | put a command's output into other command input
> | redirect a command output into a file
>> | append to end of file (e.g: echo alias c="clear" >> ~/.bash_aliasses)
&& | execute two (or more) commands together (e.g: cd ~ && clear)
Commands:
pdw | where are your current location
ls -lah | list all files with details in current directory
cd /path/to/directory | move to directory
cd- | move to previous directory
cd .. | Move to back
cd ~ | Move to home directory
touch filename | make new file
cp a location/filename | copy to other location
mv a location/filename | move (cut/paste) to another place
echo STRING >> file | make new file and add string to end of it
cat filename | show content of file
cat a b > c | join a and b and put into c
mkdir | make new directory
rm filename | remove file
rm -r directory | remove directory
locate filename | find file
locate -i STRING | search for string in all files
find LOCATION -name NAME | find name in location
grep string file | find string in file
du -m filename | get file size in MB
head -n 5 file | show first 5 lines of file
tail -n 5 file | show last 5 lines of file, add -f for realtime monitoring. also 'tailf file'
diff a b | show diffrence between files
zip b.zip a | zip b into a, aslo -r for directory
tar -cvf a.tar b | make tar archive with a name from b location. more: https://www.tecmint.com/18-tar-command-examples-in-linux/
chown user file | change owner of file to user
chmod 777 file | change permission of file. more: https://www.computerhope.com/unix/uchmod.htm
chmod +x filename | Make a file executable
top | task manager
ps ax | grep APPNAME | find pid of APP
kill pid | kill the app
pkill appname | kill app without id
history | list all commands that used
which [command] | where is command location
passwd a | change current user pass to a
man [command] | show help and manual for command
جمعه، ۱۷ آوریل ۲۰۲۰