#projects #pc

The command line

12 months ago, I would not have dared touch the command line. The terminal was the purview of hackers and based computer-nerd giga-chads and I was not one of them. I was scared I would break something and brick my computer. This is an actual possiblity, but oon’t let that put you off.

I use it everyday to ssh into my homelab, to launch a local development server or to programatically run scripts to reorganise or backup files.

The command line (also called the terminal) is a text-based tool that lets you talk directly to your computer’s operating system by typing commands instead of clicking on icons. When you enter a command, a program called the shell interprets your instructions, executes them, and displays the results right in the terminal window.

While it can look intimidating at first, the command line is an incredibly efficient tool. You can use it to:

This guy is the GOAT at teaching bash. You will never match his steez. You suck at Programming

I’ll be posting some projects, including one of how to glitch photos and videos, that will require you to use the command line. Below is a list of simple commands to get you started.

Command What it does
pwd Print the working directory
cd <directory> Go to a directory
cd .. Go up one directory
ls List directory contents
ls -la List all files with details
tree Show a directory tree, if installed

File operations

Command What it does
touch <file> Create an empty file
mkdir <dir> Create a directory
mkdir -p <dir/subdir> Create a directory and its parents
cp <src> <dest> Copy a file
mv <old> <new> Move or rename a file
rm <file> Delete a file
rm -rf <dir> Delete a directory and its contents
cat <file> Display file contents
less <file> View a file one page at a time
head <file> Show the first 10 lines
tail <file> Show the last 10 lines
tail -f <file> Follow a file as it grows

Searching

Command What it does
find . -name "*.txt" Find text files by name
grep "pattern" file Search for a pattern in a file
grep -r "pattern" . Search recursively through files
which <command> Find a command’s location
locate <file> Find a file quickly; updatedb may be needed

System information

Command What it does
df -h Show disk space in human-readable format
du -sh <dir> Show directory size
ps aux List running processes
top Monitor running processes
free -h Show memory usage
uname -a Show system information
whoami Show the current user
date Show the current date and time

Permissions

Command What it does
chmod 755 <file> Set file permissions (rwxr-xr-x)
chown user:group file Change file owner and group
stat <file> Show file information

Networking

Command What it does
ping <host> Test network connectivity
curl <url> Download or send data
wget <url> Download a file
ssh user@host Connect to a remote host
scp file user@host: Copy files to or from a remote host

Process control

Command What it does
Ctrl+C Kill the current process
Ctrl+Z Suspend the current process
bg Resume a suspended process in the background
fg Bring a process to the foreground
kill <PID> Stop a process by its process ID
killall <name> Stop processes with a given name

Redirection

Command What it does
command > file Redirect output to a file
command >> file Append output to a file
command < file Read input from a file
command1 \| command2 Pipe output from one command to another

Compression

Command What it does
tar -czf archive.tar.gz dir/ Create a compressed archive
tar -xzf archive.tar.gz Extract a compressed archive
zip -r archive.zip dir/ Create a ZIP archive
unzip archive.zip Extract a compressed archive

Shortcuts

Shortcut What it does
!! Repeat the last command
!$ Use the last argument from the previous command
history Show command history
history \| grep <cmd> Search command history
Ctrl+R Search command history interactively
Tab Auto-complete a filename or command
Ctrl+A Move the cursor to the beginning of the line
Ctrl+E Move the cursor to the end of the line
Ctrl+U Clear from the cursor to the beginning of the line
Ctrl+K Clear from the cursor to the end of the line

#projects #pc

Latest Updates

Stay in the loop

Contact

For bookings, please drop a line at contact@hatekraft.net