Linux terminal command ( Arch and Debian )
- ~ : home directory
- # : Root
- $ : User
- & : run commands in the background of your terminal
- && : combine multiple commands together
- > : re-director, take the output from a command (such as using cat to output a file) and direct it elsewhere
- >> : similar to > but instead of replacing the output, it will add it to the one already present
- –help or -h : put after the command name will show the help menu
- adduser username : to add a user
- alias : shows the shell’s aliases
- apt search packagename : search all the package with that name on it
- apt update : Debian update the system by downloading new packages
- apt upgrade : Debian install the downloaded packages
- apt install : Debian install a program/application
- apt remove : Debian remove program/application
- apt autoremove : Debian remove program/application orphan dependencies
- bc : basic calculator
- cat : shows every line inside the file from the terminal
- cd : change directory (“cd download” if you want to go to the download directory)
- cd – or cd .. : to go back to the previous directory
- chage -E date user : set expiration date for the user
- chage -l user : shows the expiration date of the user ( type -1 for never )
- chage -M days user : to set the number of days the user had to change password
- chmod : change file permission (Example: 764 = rwxrw-r–)
[d|rwx|rwx|rwx = dir/file|user|group|other] [4+2+1 = rwx = read write execute] - chmod +x filename : add execute to all
- chmod -x filename : remove execute to all
- chmod u+x filename : add execute to user only
- chsh -l : to check the path of the shell
- chsh -s /path/of/the/shell : to set the new shell for the user
- clear or “Ctrl” + “l” : clear the terminal
- “Ctrl” + “+” : zoom in
- “Ctrl” + “-“ : zoom out
- cp filename directory : copy and paste the file in the directory
- date : shows the date
- df -h : shows availible and used disk/partiton space
- diff filename1.txt filename2.txt : to check if there is difference inside the files
- echo : displays what did you type
- EDITOR=nano visudo :from root to edit with nano /etc/sudoers privileges (if member of the wheel: remove #)
- fdisk : to start modifying the disk partitions (umount device first)
- fdisk -l : shows disk and partitions
- free : shows memory and swap usage in byte
- free -m : shows memory and swap usage in Mb
- grep word filename : shows the specific word in a specific file
- grep word * : shows the specific word in every file in that directory
- grep -c word filename : count how many time the word is in that file
- grep -i word filename : same as grep alone but with no case sensitivity
- grep -n word filename : same as grep but shows also the line number
- grep -r word /path/ : shows the word inside every file and evry folder from that path
- grep -v word filename : shows every line apart for the one containing that word
- grep -name filename : to look for a specific file
- groups user : to check all the groups that the specific user is in
- help : help page documentation of the program selected
- head : print out first 10 line on the selected file
- history : it will show the command history
- htop : system monitor
- id : user identity
- ip : shows/manipulate routing, net devices and so on
- ip address : shows your IP address
- kill : close the program
- less : similar to cat, mainly used for longer files
- locate : locate the file or directory
- ls : list file and directory
- ls / : list files in the fist directory
- ls -a : list all file and directory (even the hidden one)
- ls -all or ll -a : list all file and directory + other information
- ls -lah : list all file and directory + other information in human readable number 4k instead 4000
- lsblk : list all disks and partitions
- lsplug : list all usb devices
- lspci : list pci devices
- man : manual, it’s basically the manual for another program, you can even type “man man“
- makepkg -s : run the command inside the directory of the tar -xvf extracted file to create an installation file
- mkdir : create a directory (folder)
- mkfs.typefile /dev/devname: to format the disk with the type file (ext4/exfat). create 1st partitions with fdisk
- mkfs.ext4 -n “label” /dev/devname : to label the device or partition
- mount : shows all the volumes on every disk
- mount | grep diskname : filter only the volumes on the specified disk
- mv filename directory : move file to directory
- mv filename1 filename2 : to rename file
- mv *.txt directory : to move all file with that extension
- ncdu : shows how much space is used and by which folder inside the directory
- ncdu / : shows for the all system
- ncdu / -x : same as above but only for the local system, excludes the external drives
- net : tool to administrate samba and CIFS servers
- nmap -sV ipaddress : shows port and version
- nmap -v : check the nmap version
- nmap ipaddress.0/24 : scan entire subnet (nmap -sP ipsubnet shows a simplified view)
- nmap ipaddress or hostname : to scan all the ports on that system
- nmap -T5 ipaddress : to scan at maximum speed
[ From T1 (slower but less detectable) to T5 (faster and less accurate), default is set to T3] - pacman -Qdt : queering package database for orphans, so they can be removed
- pacman -R: Arch program remove
- pacman -S: Arch program install
- pacman -Ss keyword : Arch program search for packages using keyword
- pacman -Syu : Arch to update/upgrade
- pacman -Syy : Arch refresh package databese
- pacman -U filename : use it inside the directory where the file to install the selected file after makepg -s
- passwd -l user : lock the user sccount
- passwd -u user : unlock the user sccount
- ping ipaddress: test and send packages to the specify web address
- ps : process status
- pwd : print working directory (shows you where you are)
- reboot : reboot the system
- rmdir : remove directory
- rm filename : remove file
- rm -rf directory or filename : forcefully remove directory and all it’s files
- samba : server that provides services to clieants
- sar -b : to check why system is slowing down
- sar -r : to check current memory
- sar -S : to check current swap
- sar -u : to check current cpu usage
- sar -u -f /etc/var/log/sysstat/filename : to check the specific log that was saved
- ss : investigate sockets
- ssh username@ipaddress : to log in using ssh
- su : to switch to root
- su username : to switch to the username
- sudo : obtain administrator privileges
- sudo !! : to run the last command if you forgot to put sudo on the front
- tail : print out last 10 line of the select file
- tar -xvf filename : extract the wget downloaded compressed file
- time commandname : shows how much time the command took
- top : shows all the running program
- touch filename.txt : to create a text file (or you can create one with the text editor: nano filename)
- umount /dev/devname : unmount the device or partition but still able to see it
- unalias aliasname : remove the alias
- uname : info on device
- usermod -aG group user : add the specific user to the specific group ( type ” , ” without spaces to add more groups )
- usermod -d /testhome/testdir/ –move-home username : to move the user’s home directory to a new one with all it’s files
- usermod -e date user : to set an expiration date for the user
- usermod -l newname oldname : to change user’s name
- usermod -L user : to lock that specific user
- usermod -U user : to unlock that specific user
- visudo : to edit configuration file, temporary saves it and checks the syntax for error
- wget : non interactive network downloader “wget URL“
- whereis : path the command select + man page
- which command : path to the command select “which ls”
- who : who is logged in
- whoami : to check the name user
- yay : same as pacman but for AUR (automated)
- yay -Syu : update/upgrade standard and AUR