docs/guides/linux-basics.md
2023-06-27 09:00:08 +01:00

1.7 KiB

title description published date tags editor dateCreated
The basics of Linux Simple examples showing you around Linux true 2023-06-27T07:54:18.672Z linux, server markdown 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 <directory>
  • 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 <directory>
  • Create a new file: touch <file>
  • Copy a file: cp <file> <new-file>
  • Remove a file: rm <file>
  • Remove a directory: rm -r <directory>

File Permissions

  • Change file permissions: chmod <permissions> <file>
  • Change file ownership: chown <user> <file>
  • Change file ownership (recursively): chown -R <user> <directory>
  • View file permissions: ls -l <file>

Text Processing

  • View a file: cat <file>
  • View a file (with line numbers): cat -n <file>
  • Get the beginning of a file: head <file>
  • Get the end of a file: tail <file>

Package Management (Ubuntu)

  • Update package lists: sudo apt update
  • Install a package: sudo apt install <package>
  • Purge a package: sudo apt purge <package>
  • Remove a package: sudo apt remove <package>
  • Search for a package: apt search <package>
  • Upgrade packages: sudo apt upgrade

File Compression and Archiving

  • Create a tar archive: tar -cvf <archive.tar> <file>
  • Extract a tar archive: tar -xvf <archive.tar>
  • Create a zip archive: zip <archive.zip> <file>
  • Extract a zip archive: unzip <archive.zip>