Linux GPT 2
Linux GPT 2
HadyHashim (Updated)
Grok 3, xAI
May 16, 2025
Abstract
This updated document summarizes all Linux commands and topics discussed
with HadyHashim, covering file system navigation, file management, permissions,
package installation, user/group management, process management, services, SSH,
networking, file systems, and server analysis. It includes detailed explanations
of command options (e.g., -i, -R, -aG) and solutions to specific questions (e.g.,
permissions on /media/hadyhashim, copying files, .deb installation, and usermod
-aG).
Introduction
This guide is tailored for HadyHashim, a beginner learning Linux on Ubuntu. It covers
all discussed commands and concepts, with practical examples tested in the context of
the user hadyhashim. This version includes new topics (process management, services,
SSH, networking, file systems, server analysis) and detailed explanations of command
options.
Paths:
1
2 Navigation and File Management Commands
• pwd: Prints current directory.
pwd # Output : /home/ hadyhashim
ls # List files
ls -l # Detailed list
ls -a # Show hidden files
ls -la # Combine detailed and hidden
ls -ld . # Show current directory details
2
– -r: Recursive (for directories).
– -f: Force deletion without prompt.
• Options:
3
• Example:
echo -e " Ubuntu \ nDebian \ nArch " > sample .txt
grep -n " Ubuntu " sample .txt # Output : 1: Ubuntu
grep -c " Ubuntu " sample .txt # Output : 1
grep -v " Ubuntu " sample .txt # Output : Debian , Arch
4 Package Management
• apt: Manages packages on Ubuntu.
4
Example (Google Chrome):
curl -O https :// dl. google .com/ linux / direct /google -chrome
- stable_current_amd64 .deb
sudo apt install ./ google -chrome - stable_current_amd64 .
deb
google - chrome
5 Permissions Management
• chmod: Changes file/directory permissions.
– -R: Recursive.
– -R: Recursive.
– -m: Modify ACL (e.g., u:hadyhashim:rwx).
– -d: Set default ACL for new files/directories.
– -x: Remove ACL entry.
5
Example (Fixing permissions on /media/hadyhashim):
ls -ld /media / hadyhashim # Check permissions (e.g., drwxr -xr -x root
root)
sudo setfacl -R -m u: hadyhashim :rwx / media / hadyhashim
touch / media/ hadyhashim / test_file .txt # Test write access
6
• sudo: Executes commands with root privileges.
sudo apt update # Run apt update as root
sudo ls /root # List root directory
8 Process Management
• ps: Lists running processes.
Example:
ps aux | grep bash # Find bash processes
htop # Monitor processes
killall gedit # Terminate gedit
7
– list-units: List active units.
• Configure /etc/ssh/sshd_config:
sudo nano /etc/ssh/ sshd_config
# Change port (e.g., Port 2222)
# Disable root login ( PermitRootLogin no)
sudo systemctl restart ssh # Apply changes
• Test SSH:
ssh hadyhashim@localhost -p 2222
8
11 Network Management
• ip: Displays network information.
– a: Show IP addresses.
– r: Show routing table.
ip a # Show IP addresses
ip r # Show routing
– -h: Human-readable.
– -s: Summarize total size.
9
• fdisk: Manages disk partitions (requires sudo).
sudo fdisk -l # List partitions
0. Backup /etc/fstab:
sudo cp /etc/ fstab /etc/ fstab .bak
0. Edit /etc/fstab:
sudo nano /etc/ fstab
Add:
UUID =1234 - ABCD / media / hadyhashim / New_Volume_2 ext4 rw ,
uid =1000 , gid =1000 0 2
10
14 Server Analysis and Support
• lscpu: Shows CPU information.
lscpu # Show CPU details
– -h: Human-readable.
• Getting Support:
0. Listing Directories:
11
0. Package Installation:
• Asked about installing programs and .deb files, and apt, curl.
• Covered: apt update, apt install, curl -O, wget, apt install ./example.deb.
0. Permissions on /media/hadyhashim:
• Asked how to copy a file to a parent directory (one or two levels up).
• Covered: cp file.txt .., cp file.txt ../...
0. Additional Commands:
16 Conclusion
This updated summary covers all commands, topics, and questions discussed with Hady-
Hashim, including detailed explanations of command options. For further learning, ex-
plore shell scripting or advanced networking. To automate HDD mounting, edit /etc/fstab
as described.
12