--- title: The basics of Linux description: Simple examples showing you around Linux published: true date: 2023-06-27T07:54:18.672Z tags: linux, server editor: markdown dateCreated: 2023-06-27T07:54:18.672Z --- # Linux Basics This guide provides a brief introduction to Linux, including basic commands and concepts. ## Navigating the filesystem - Change a directory: `cd ` - List files in a directory: `ls` - List files in a directory (including hidden files): `ls -a` - Getting the current directory: `pwd` - Going back a directory: `cd ..` ## Managing Files and Directories - Create a new directory: `mkdir ` - Create a new file: `touch ` - Copy a file: `cp ` - Remove a file: `rm ` - Remove a directory: `rm -r ` ## File Permissions - Change file permissions: `chmod ` - Change file ownership: `chown ` - Change file ownership (recursively): `chown -R ` - View file permissions: `ls -l ` ## Text Processing - View a file: `cat ` - View a file (with line numbers): `cat -n ` - Get the beginning of a file: `head ` - Get the end of a file: `tail ` ## Package Management (Ubuntu) - Update package lists: `sudo apt update` - Install a package: `sudo apt install ` - Purge a package: `sudo apt purge ` - Remove a package: `sudo apt remove ` - Search for a package: `apt search ` - Upgrade packages: `sudo apt upgrade` ## File Compression and Archiving - Create a tar archive: `tar -cvf ` - Extract a tar archive: `tar -xvf ` - Create a zip archive: `zip ` - Extract a zip archive: `unzip `