|
| 1 | +--- |
| 2 | +title: "A guide to the Linux command line" |
| 3 | +date: "2025-09-15" |
| 4 | +description: | |
| 5 | + In this guide i will be going over how the Linux command line works. |
| 6 | + I will be discussing what parts it is made of and how they all work together. |
| 7 | + I will also be covering command commands that every person should know. |
| 8 | + And i will cover the basics of shell scripting. |
| 9 | +
|
| 10 | +summary: "In this guide i will be comparing only the major differences between C# and C++" |
| 11 | +ShowToc: true |
| 12 | +TocOpen: true |
| 13 | +ShowBreadCrumbs: true |
| 14 | +--- |
| 15 | + |
| 16 | +## Parts of the command line |
| 17 | + |
| 18 | +The linux command line is not one singular thing, it consists of many parts. |
| 19 | +Each having a specific important purpose. Each of these parts is modular and can be swapped out to fit your needs. |
| 20 | + |
| 21 | +**The Terminal:** |
| 22 | + |
| 23 | +The terminal (often called terminal emulator), is a front end interface that allows you to interact with the shell of the system. |
| 24 | +At its core its just a window in which you input text which gets passed down to the shell and then displays the output of the shell. |
| 25 | +The terminal emulator does not understand commands, it just passes input to the shell and renders output. |
| 26 | +Common terminal emulators include: ``Konsole``, ``Kitty``, ``Gnome Terminal``, and ``Ghostty``. |
| 27 | + |
| 28 | +**The Shell:** |
| 29 | + |
| 30 | +The shell is a program that interprets commands and then runs the right programs. |
| 31 | +It is like the bridge between the user and the kernel. its the most basic form of interacting with your system. |
| 32 | +The most commonly used shell programs are: ``Bash``, ``Zsh``, ``Powershell``. |
| 33 | + |
| 34 | +**The Binaries:** |
| 35 | + |
| 36 | +The shell itself doesnt execute anything, it just interprets a command and then executes the correct binary programs with the correct arguments. |
| 37 | +Each command is just calling one or more of those binary programs. |
| 38 | +So the commands like: ``cd``, ``ls``, ``cat``. |
| 39 | +Are basically just names of executable binaries. |
| 40 | +All major Linux distro's come with a standard set of these commands (binaries). |
| 41 | +Most of these binaries are part one of the following projects: ``gnu-coreutils``, ``util-linux``, ``procps-ng``, ``iproute2``, ``iputils``. and then there are a number of binaries that are their own projects. |
| 42 | +But you can be sure that all major Linux distros come with the binaries of those 5 projects, so if you learn those you are set. |
| 43 | + |
| 44 | +## Commonly used commands |
| 45 | + |
| 46 | +<table> |
| 47 | + <thead> |
| 48 | + <tr> |
| 49 | + <th>Command</th> |
| 50 | + <th>Project</th> |
| 51 | + <th>Description</th> |
| 52 | + </tr> |
| 53 | + </thead> |
| 54 | + <tbody> |
| 55 | + <tr><td>ls</td><td>gnu</td><td>List files and directories</td></tr> |
| 56 | + <tr><td>cd</td><td>bash</td><td>Change the current directory</td></tr> |
| 57 | + <tr><td>pwd</td><td>gnu</td><td>Print current working directory</td></tr> |
| 58 | + <tr><td>cp</td><td>gnu</td><td>Copy files or directories</td></tr> |
| 59 | + <tr><td>mv</td><td>gnu</td><td>Move or rename files/directories</td></tr> |
| 60 | + <tr><td>rm</td><td>gnu</td><td>Remove files or directories</td></tr> |
| 61 | + <tr><td>mkdir</td><td>gnu</td><td>Create directories</td></tr> |
| 62 | + <tr><td>rmdir</td><td>gnu</td><td>Remove empty directories</td></tr> |
| 63 | + <tr><td>touch</td><td>gnu</td><td>Create empty file or update timestamp</td></tr> |
| 64 | + <tr><td>cat</td><td>gnu</td><td>Display or concatenate file contents</td></tr> |
| 65 | + <tr><td>echo</td><td>bash</td><td>Print text to stdout</td></tr> |
| 66 | + <tr><td>chmod</td><td>gnu</td><td>Change file permissions</td></tr> |
| 67 | + <tr><td>chown</td><td>gnu</td><td>Change file owner and group</td></tr> |
| 68 | + <tr><td>find</td><td>gnu</td><td>Search for files in directories</td></tr> |
| 69 | + <tr><td>grep</td><td>gnu</td><td>Search text in files using patterns</td></tr> |
| 70 | + <tr><td>ps</td><td>procps-ng</td><td>Show currently running processes</td></tr> |
| 71 | + <tr><td>kill</td><td>gnu</td><td>Terminate a process by PID</td></tr> |
| 72 | + <tr><td>uname</td><td>gnu</td><td>Show system and kernel information</td></tr> |
| 73 | + <tr><td>uptime</td><td>procps-ng</td><td>Show system uptime and load</td></tr> |
| 74 | + <tr><td>who</td><td>util-linux</td><td>Show who is logged in</td></tr> |
| 75 | + <tr><td>id</td><td>gnu</td><td>Show user and group IDs</td></tr> |
| 76 | + <tr><td>groups</td><td>gnu</td><td>List groups for a user</td></tr> |
| 77 | + <tr><td>tar</td><td>gnu</td><td>Archive or extract files</td></tr> |
| 78 | + <tr><td>gzip</td><td>gnu</td><td>Compress files</td></tr> |
| 79 | + <tr><td>gunzip</td><td>gnu</td><td>Decompress gzip files</td></tr> |
| 80 | + <tr><td>ping</td><td>iputils</td><td>Test network connectivity</td></tr> |
| 81 | + <tr><td>ip</td><td>iproute2</td><td>Show or configure network interfaces</td></tr> |
| 82 | + <tr><td>which</td><td>other</td><td>Locate a command in PATH</td></tr> |
| 83 | + <tr><td>whereis</td><td>util-linux</td><td>Locate binaries, source, and manuals</td></tr> |
| 84 | + <tr><td>type</td><td>bash</td><td>Show command type information</td></tr> |
| 85 | + <tr><td>basename</td><td>gnu</td><td>Strip directory path from filename</td></tr> |
| 86 | + <tr><td>dirname</td><td>gnu</td><td>Strip filename to show directory path</td></tr> |
| 87 | + <tr><td>xargs</td><td>gnu</td><td>Build and execute commands from input</td></tr> |
| 88 | + <tr><td>env</td><td>gnu</td><td>Show or set environment variables</td></tr> |
| 89 | + <tr><td>export</td><td>gnu</td><td>Set environment variables for child processes</td></tr> |
| 90 | + <tr><td>mount</td><td>util-linux</td><td>Mount disks or drive</td></tr> |
| 91 | + <tr><td>unmount</td><td>util-linux</td><td>Unmount disks or drive</td></tr> |
| 92 | + <tr><td>fdisk</td><td>util-linux</td><td>Manages disks or drives</td></tr> |
| 93 | + <tr><td>curl</td><td>other</td><td>Downloads files from the web</td></tr> |
| 94 | + <tr><td>wget</td><td>other</td><td>Downloads files from the web</td></tr> |
| 95 | + </tbody> |
| 96 | +</table> |
| 97 | + |
| 98 | +## Basics of bash and scripting |
| 99 | + |
| 100 | +comming soon... |
| 101 | + |
| 102 | +## Posix and compatibility |
| 103 | + |
| 104 | +comming soon... |
0 commit comments