In Part 2 of my Cybersecurity Fundamentals, I covered basic Linux Terminal commands. Like a video game tutorial, first you learn how to look around and move. I also shared some commands for manipulating and moving files. Now, it's time to learn some advanced moves and ways to navigate your digital world.
For Part 2-2 of this series, I want to get into some more advanced commands used in order to find directories and files, search text within files, change user permissions, extraction, compression, chaining commands together, install and view packages and processes.
Note: As a reminder, inline code will be designated with ticks, ``. ie. `sudo`.
These commands are used in Linux Terminal's command line. For more information on each, remember the all important `man` command, short for manual. In Terminal, try `man grep` <enter>.
- `sudo`: Placed in front of a command to execute it with admin privileges. Use with caution and only when necessary.
- `grep`: Search a text file for a string of text. Stands for "Global Regular Expression Print".
- `locate`: Quickly search a pre-made database of files and directories in your system. `updatedb` would need to be used to update the DB `locate` uses after changes are made to the file system.
- `find`: Not as fast as `locate` as it directed searches the system, but this means no update is required. Provides more flexibility than `locate` as you can narrow searches down to file type, size, and modifcation time.
- `awk`: Text processing tool that searches for patterns within files and manipulates the matched text, often used for data extraction and transformation..
- `tar`: Used to archive and compress multiple files and directories into a single archive file. By itself, it does not unzip.
- `su`: Command to switch users.
- `chown`: Used to change the owner and/or group ownership of a file or directory in a Linux system.
- `apt`: Package management system used to install, remove, and update software packages on Debian-based Linux distributions, such as Ubuntu and Linux Mint.
- `top`: Stands for Table of Processes. Similar to Task Manager in Windows. Real-time, dynamic info on process CPU and memory usage.
- `ps`: Process snapshot. A static snapshot of processes running on your system.
- `systemctl`: Used to manage system services in Linux: start, stop, restart, enabling or disabling services.
- `nano`: An easy to use command line based text editor.
- `vim`: A more advanced command line text editor, and harder to learn.
Chaining commands, etc; creating "one-liners".
- `>` : Output Redirection. Redirects standard command output to a new file, or will overwrite an existing file.
- `>>`: Append Output. Appends standard command output to a new file or adds to an existing file.
- `&`: Ampersand; Background Job. When placed at the end of a command, this tells that command to run in the background, to allow you to continue working. This would be useful when installing a large package but not wanting to wait for it to finish installing while you continue working.
- `&&`: Conditional Execution Operator; Logical AND. This connects two commands and only runs the second command if the first one succeeds.
- `|`: Pipe Operator. Used to connect the output of one command to the input of another.
- Arguments: Also known as an option or a flag. Arguments modify the behavior of a command, adding additional instructions. Ie. `grep -r "python" documents`; recursively searched the folder
- Subcommands: Specific commands to extend functionality of a program. For instance, in `systemctl`, the [enable/restart/disable] options are subcommands of the main command.
- Dynamic: Processes continuously updated in real time. Eg. `top` command is a dynamic process.
- Static: A snapshot of current processes taken at a point in time. Eg. `ps` is a static process.
- Shell Operators AKA Redirection Operators: Symbols used to redirect the input or output of a command. Eg. >, >>, &, &&
- Package: Like a program; a bundle of software components, often pre-configured and ready to run. `apt` is a package management system that handles Debian-based distros.
- Package Management System: Software tool used to manage Linux packages by installing, updating, upgrading, and uninstalling.
I'll add some code blocks, screen snips, and examples later.