# Linux Commands
## File and Directory Management
### List Available Commands
```bash
ls /usr/bin
ls /usr/bin | wc -l
Print to screen
echo
Print the current directory
pwd
List files or existing directories
ls
- List all files, including hidden ones
ls -a
- List in long format
ls -l
Change directory
cd
Copy a directory
cp
Move or rename a directory or folder
mv
Create a directory
mkdir
Remove a directory
rmdir
Remove a file
rm
Force delete
rm -rf
Create a file
touch
Provide more information about the file
less
Concatenate (create, merge, and print files to the screen)
cat
Show the last 10 lines of a file
tail
Show the first 10 lines of a file
head
Ask for the path of a directory's binary
which
View the entire list of aliases
alias
Is used to quickly find files on the system, and it also uses a database
locate file
Update batabase
sudo updatedb
Real-time search by traversing the file system
find /file/route -name file
System host name
hostname
Current user of the system
whoami
Search for the given word inside a file
grep
Check the space of a file inside a directory
du
- In Bytes, Kilobytes, Megabytes
du -h
grep username /etc/passwd
apt list --installed
sudo apt-cache search <package>
dpkg-query -l
dpkg -l
sudo apt-cache show <package>
Remove installed programs
apt-get remove <package>
Remove all data of the programs
sudo apt-get purge <package>
Clean up some program logs
sudo apt-get autoremove
Tool for installing, copying, deleting, and manipulating packages
dpkg
Useful for obtaining content from the web, compatible with HTTPS, HTTP, and FTP protocols
wget <url>
echo $PATH
echo $LANG
env
Check for updates
sudo apt-get update
Update all programs to their latest versions and install system updates easily
sudo apt-get upgrade
Activate administrator mode
sudo su
passwd
chmod 777 file
chmod 755 file
chmod 644 file
chmod 000 file
chmod u+x file
chmod g-w file
chmod o+r file
Exit administrator mode
exit
sudo apt install timeshift
sudo timeshift --create --comments ""
sudo timeshift --restore
timeshift --list
sudo timeshift --restore --snapshot ID
sudo timeshift --delete --snapshot ID
reboot
init 6
tar -cvf archive.tar.gz /directory
- -c: Create a new archive
- -v: Show what is being archived
- -f: Specify the filename of the tar archive
tar -xvf archive.tar.gz /directory
- -x: Extract the tar archive
- -v: Show what is being extracted
- -f: Specify the filename of the tar archive
tar -tf archive.tar.gz
Show a hidden message
apt moo
Display system information
neofetch
Show a matrix animation in the terminal
cmatrix
Show the temperature of the processor and GPU
sensors
Show system processes in an interactive interface
top
htop
Create ASCII art text
figlet