Linux Essentials covers the terminal, files, permissions, packages, processes, services and networking. Based on the attached 28-slide presentation, with expanded explanations and commands for independent practice.
1. Unix, GNU, Linux and distributions
Unix is the historical foundation; GNU provides tools and free software; Linux is the kernel managing CPU, memory, disks, devices and networking. A distribution combines the kernel, system tools, packages and configuration into a usable system. Ubuntu is based on Debian; Fedora and RHEL belong to the Red Hat family. Drivers connect the kernel to hardware.
- Commercial software is sold for payment and can also be open source. Freeware is free to use but not necessarily open source; shareware is a trial or limited version.
- Open source provides source-code access under a license. FSF promotes user freedoms; OSI defines open-source principles. GPL requires preserving its license terms when distributing covered derivative works.
2. Terminal, shell and help
The terminal is the window; the shell interprets commands and launches programs. Bash is common; zsh and fish are alternatives. /etc/shells lists registered shells. Unlike CMD, Linux paths use / and names are case-sensitive: Notes.txt and notes.txt differ. uname -r shows the kernel version; /etc/os-release identifies the distribution.
3. Paths, files and directories
pwd shows the current directory; ls -la includes hidden files, owners and permissions; cd changes directories. A path starting with / is absolute; other paths are relative to the current directory. . means current, .. parent and ~ home. Quote names containing spaces.
- mkdir -p creates parent directories. touch creates an empty file if absent, otherwise updates timestamps. cp copies; mv moves or renames.
- If backup already exists, cp -r project backup/ creates backup/project. Repeating it may overwrite files, so inspect the destination first.
- /home holds user homes; /etc configuration; /var/log logs; /tmp temporary files; /root the root user's home. A name starting with a dot is hidden from ordinary ls output.
4. Editing, searching and output redirection
nano notes.txt opens the editor if installed: Ctrl+O then Enter saves; Ctrl+X exits. Use cat for a short file and less for paged reading (q exits). grep searches text inside files; find searches for files by attributes. grep -i, -n, -r mean ignore case, show line numbers and search recursively.
- > replaces existing content; >> appends. | sends output to the next command. && runs the next command only if the previous one succeeded.
- tail -f waits for new lines; stop it with Ctrl+C. The grep example should show 2:ERROR: test. Quoting *.log prevents the shell from expanding the pattern before find runs.
5. Users, permissions and sudo
ls -l shows type, permissions and owner. The three permission groups are owner, group and others: r=4 read, w=2 write, x=1 execute. On directories, x permits traversal; deleting a file depends on parent-directory permissions. chmod changes permissions; chown changes owner and group.
6. Packages and processes
On Debian/Ubuntu, apt update refreshes package information, not installed programs. apt install installs; apt upgrade upgrades installed packages; apt remove removes them. Review proposed changes before confirming. ps aux lists processes and PIDs; top shows live resource use (q exits). kill PID sends SIGTERM for graceful termination; kill -9 sends SIGKILL as a last resort.
7. Services, logs, networking and SSH
A service is a background program. systemctl status checks state; start starts it now; enable configures boot-time startup but does not necessarily start it immediately. journalctl reads systemd logs. The examples require an SSH server: Ubuntu/Debian use openssh-server and the ssh service; Fedora/RHEL usually use sshd.
ip a shows addresses and interfaces; ip r shows routes and the gateway. ping checks ICMP responses; no response does not prove a server is down. getent hosts checks name resolution using system settings, including /etc/hosts and DNS. For an authorized server, substitute the user and address in ssh user@server-ip; verify the service, port, credentials or key and server fingerprint.
- No such file: check pwd, path and case. command not found: check spelling, installation and PATH.
- Permission denied: check id and ls -l; for SSH also check user and authentication. Connection refused: check the listening service and port; a firewall may also reject the connection.
8. Independent practice — 15 minutes
In the practice VM, create a workspace, log, backup and private file. Run once; if you already followed the examples above, inspect files first to avoid overwriting important content.
- grep prints 2:ERROR: test; find locates the log and its backup copy.
- ls -l shows -rw------- for private.txt. Your user owns it; the empty file has size 0.
- Explain what changes if you replace >> with >, and why cp differs from mv. Test only on a disposable file.
9. Your first Bash script
In your practice directory, open nano hello.sh, enter the following text and save. The first line selects the interpreter; printf prints text and a newline.
After saving, grant the owner execute permission and run it. ./ refers to the current directory; expected output is Hello, Linux!.