
Ubuntu, Fedora, Gnome, Package Managers
Linux Directories

System Information
$ man <command> # Manual of the <command>
$ <command> -h # Command help
## Update System
$ sudo apt update && sudo apt upgrade # Update (Debian/Ubuntu)
$ sudo dnf upgrade --refresh # Update (Red Hat/Fedora)
## System and User Information
$ pwd # print work directory
$ whoami # show user
$ date # show date and time
$ uname # show info system
$ uname -a # show verbose info system
$ hostname # hostname system
$ hostnamectl # info about the system, including hostname, OS, architecture, hardware, etc
$ fastfetch
$ htop <or> btop
Files and Directories
## Browsing Files and Directories
$ cd directory # change to directory
$ cd /etc/directory # change to specific directory
$ cd .. # change to parent directory
$ ls # list files
$ ls -l # list files and permissions
$ ls -a # list hidden files
$ ll # list all the files, hidden and permissions
## Creating Files and Directories
$ touch <file> # create file
$ nano file.txt # Read and edit file.txt
$ mkdir <folder> # Create directory
$ mv <source> <destination> # Move file (or rename file)
$ mv first.txt second.txt
$ cp <source> <destination> # Copy file (duplicate file)
$ cp second.txt third.txt
$ rm <file> # Remove file (not directories)
$ rm *.pdf # Remove using wildcard
$ rm -f <file> # Remove without prompting (force)
$ rm -d <dirname> # Remove empty directory
$ rm -r <dirname> # Remove non-empty directory
$ rmdir <dirname> # Remove empty directory
## Text Editing and Processing
nano [file] : Opens a file in the Nano text editor.
cat <file> : Displays the contents of a file.
less <file> : Displays the paginated content of a file.
head <file> : Shows the first few lines of a file.
tail <file> : Shows the last few lines of a file.
awk ‘{print}’ [file] : Prints every line in a file.
## Searching and Finding
$ sudo find -name <file/package> # Find package by name
$ sudo find . -name file.php # Find a file by name or extension
$ sudo find . -name "*.txt"
$ grep <pattern> <file> # Find text in a file
Package Management
## Install and Unistall DEB Packages (Debian/Ubuntu)
$ sudo apt install <package> # From repositories
$ sudo apt install ./<package.deb> # Local deb file
$ sudo apt list --installed # List deb packages installed
$ sudo find -name <file/package> # Find package by name
$ sudo apt purge <package> # Uninstall package and its dependencies
$ sudo apt autoremove. # Clean dependencies not used
## Install and Unistall RMP Packages (Red Hat/Fedora)
$ sudo dnf install <package> # From repositories
$ sudo dnf install ./<package.rpm> # Local rpm file
$ sudo dnf remove <package> # Remove <package>
$ sudo dnf autoremove # Clean obsolete dependencies
## PACKAGES
Package management (APT)
sudo apt install <package> : Installs a package.
sudo apt install -f –reinstall <package> : Reinstalls a broken package.
apt search <package> : Searches for APT packages.
apt-cache policy <package> : Lists available package versions.
sudo apt update : Updates package lists.
sudo apt upgrade : Upgrades all upgradable packages.
sudo apt remove <package> : Removes a package.
sudo apt purge <package> : Removes a package and all its configuration files.
Package management (Snap)
snap find <package> : Search for Snap packages.
sudo snap install <snap_name> : Installs a Snap package.
sudo snap remove <snap_name> : Removes a Snap package.
sudo snap refresh : Updates all installed Snap packages.
snap list : Lists all installed Snap packages.
snap info <snap_name> : Displays information about a Snap package.
## Processes
$ ps # View the user current processes
$ ps -e | more # View all processes
$ top # View CPU, Ram and Resources
$ htop
System monitoring and management
top : Displays real-time system processes.
htop : An interactive process viewer (needs installation).
df -h : Shows disk usage in a human-readable format.
free -m : Displays free and used memory in MB.
kill <process id> : Terminates a process.
Service management
sudo systemctl start <service> : Starts a service.
sudo systemctl stop <service> : Stops a service
sudo systemctl status <service> : Checks the status of a service.
sudo systemctl reload <service> : Reloads a service’s configuration without interrupting its operation.
journalctl -f : Follows the journal, showing new log messages in real time.
journalctl -u <unit_name> : Displays logs for a specific systemd unit.
## Recover Desktop
Ctrl + Alt + F3
sudo systemctl restart gdm # Gnome
sudo systemctl restart sddm # KDE
## Power Management (MacBooks)
sudo dnf install tlp
sudo systemctl enable tlp
## Battery health check
upower -i $(upower -e | grep BAT)
upower -i /org/freedesktop/UPower/devices/battery_BAT0
## RPM Fusion
dnf repolist
rpmfusion-free
rpmfusion-nonfree
## Download files
$ wget
$ curl
$ git clone
## Permissions
$ chmod <mode> <file> # Change mode file (r=read, w=write, x=execute)
$ chmod +x <file> # Add executable permissions to the file
$ chmod 0755 helloworld.sh # change the file mode and permissions
$ chmod -R 600 <dir> # Change permission to <dir> and its contents
$ chown <owner:group> <file> # Change ownership of file
File permissions and ownership
chmod [who][+/-][permissions] <file> : Changes file permissions.
chmod u+x <file> : Makes a file executable by its owner.
chown [user]:[group] <file> : Changes file owner and group.
## Users
$ sudo adduser <newuser> # add user
$ usermod -aG sudo <newuser> # enable sudo access to <newuser>
user@server:~$ sudo su # switch to root user
root@server:~# # root user enabled
root@server:~# su - <user> # switch to <user>
$ sudo passwd <user/root> # change password to <user/root>
w : Shows which users are logged in.
sudo adduser <username> : Creates a new user.
sudo deluser <username> : Deletes a user.
sudo passwd <username> : Sets or changes the password for a user.
su <username> : Switches user.
sudo passwd -l <username> : Locks a user account.
sudo passwd -u <username> : Unlocks a user password.
Sudo change <username> : Sets user password expiration date.
Group management
id [username] : Displays user and group IDs.
groups [username] : Shows the groups a user belongs to.
sudo addgroup <groupname> : Creates a new group.
sudo delgroup <groupname> : Deletes a group.
$ df # Disk Free view file systems and free space
$ df -h # View human-readable sizes
$ rsync # Sync files between storage devices
## Gzip file.gz
$ gzip filename # Compress to filename.gz
$ gzip -k filename # Compress to filename.gz (Keeping original too)
$ gzip -d file.gz # Unzip file.gz
$ gzip -dk file.gz # Unzip file.gz (Keeping compressed file too)
$ gunzip file.gz # Unzip file.gz
## Tape Archive tar.gz
$ tar --create (-c) # Create a new tar archive.
$ tar --extract (-x) # Extract the entire archive or one or more files from an archive.
$ tar --list (-t) # Display a list of the files included in the archive
$ tar -xf archive.tar.gz # Uncompress archive.tar.gz
Archiving and compression
tar -czvf <name.tar.gz> [files] : Compresses files into a tar.gz archive.
tar -xvf <name.tar.[gz|bz|xz]> [destination] : Extracts a compressed tar archive.
## cURL (Client URL) It enables transferring data from or to a server, using HTTP, HTTPS, FTP, etc. (Postman is a UI for curl)
$ curl [options / URL]
$ curl https://jsonplaceholder.typicode.com/todos/1 # Quick GET method to URL
$ curl -X GET https://jsonplaceholder.typicode.com/todos/1 # (-X == --request)
## Hardware
$ lspci # This command displays information about PCI buses and devices connected to them. Internal devices like network adapters, sound cards, and graphic cards are often connected via PCI.
$ lsusb # This command lists USB devices connected to the system. Some internal devices may also connect via USB interfaces.
$ lsblk # This command lists block devices such as hard drives, SSDs, and partitions.
$ lshw # This command provides detailed information about hardware components, including internal devices.
$ dmidecode # This command displays information about the system's hardware components as reported by the system BIOS. It can provide details about internal devices such as memory modules, processors, etc.
$ hwinfo # This command provides detailed hardware information, including internal devices, in a structured format.
$ udevadm # This command can be used to query the udev device manager for information about devices.
Networking
## Networking Commands
$ ip address # Formerly "ifconfig"
$ sudo apt install net-tools
$ ip route # View the IP routing table
$ sudo ip address add 192.168.121.241/24 dev eth0
$ ping <host>
$ dhclient -r # Release IP address
$ dhclient # Get a new IP address
ip addr show : Displays network interfaces and IP addresses.
ip -s link : Shows network statistics.
ss -l : Shows listening sockets.
ping <host> : Pings a host and outputs results.
Netplan configuration (read more at netplan.io)
cat /etc/netplan/*.yaml : Displays the current Netplan configuration.
sudo netplan try : Tests a new configuration for a set period of time.
sudo netplan apply : Applies the current Netplan configuration.
$ nmap -sT <host>
## DNS
$ dig # (Domain Information Groper) Lookup info from DNS servers
$ cat # Concatenate (Link together in a series)
$ dig domain.com # get IP information
$ dig domain.com TXT # get DNS TXT record info
$ nslookup domain.com # get IP information
$ whois domain.com # get domain information
Local Firewall Server
## Security Firewall
$ sudo apt install ufw
$ sudo ufw enable
$ sudo ufw disable
$ sudo ufw app list
$ sudo ufw status
$ sudo ufw status verbose
$ sudo ufw status numbered
$ sudo ufw delete <number>
$ sudo ufw allow 'Nginx Full'
$ sudo ufw allow Apache
$ sudo ufw delete allow 'Nginx HTTP'
$ sudo ufw delete allow Apache
$ sudo ufw deny from <ip>
$ sudo ufw allow from <ip> to any port 3306
$ sudo ufw deny out <port> # close <port>
sudo ufw status : Displays the status of the firewall.
sudo ufw enable : Enables the firewall.
sudo ufw disable : Disables the firewall.
sudo ufw allow <port/service> : Allows traffic on a specific port or service.
sudo ufw deny <port/service> : Denies traffic on a specific port or service.
sudo ufw delete allow/deny <port/service> : Deletes an existing rule.
chmod command modes
7
Read, Write, Execute
rwx
6
Read, Write
rw-
5
Read, Execute
r-x
4
Read
r—
3
Write, Execute
-wx
2
Write
-w-
1
Execute
—x
0
-
—-
Gnome Tweaks, Extensions and Flatpak
gsettings set org.gnome.shell.extensions.dash-to-dock show-apps-at-top true
gsettings set org.gnome.desktop.wm.preferences button-layout ':minimize,maximize,close'
sudo apt install gnome-tweaks
sudo apt install flatpak
sudo apt install gnome-software-plugin-flatpak # Install packages using ubuntu software
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo # Add Flathub repo
(Restart)
flatpak install flathub <app-id>
flatpak install flathub com.mattjakeman.ExtensionManager
dash-to-panel@jderose9.github.com
dash-to-dock@micxgx.gmail.com
zwallpaper@azwallpaper.gitlab.com
blur-my-shell@aunetx
kiwimenu@kemma
fastfetch
htop
btop
neo -m "SYSTEM OVERRIDE"
gradia
onlyoffice
thunderbird
localsend
planify
Displaylink Lenovo Driver
## Synaptics APT Repository for Ubuntu
https://www.synaptics.com/products/displaylink-graphics/downloads/ubuntu
sudo apt install ./Downloads/synaptics-repository-keyring.deb
sudo apt update
sudo apt install displaylink-driver
Compose Key Multilingual
œ
« »