sudo, pipes, redirects, and man pages — the connective tissue that makes every other command more powerful.
sudo — borrowing admin rights #
sudo apt update
# run this command with administrative privileges
The pipe: | #
This might be the single most powerful idea in the entire shell: the output of one command becomes the input of the next.
ps aux | grep nginx
ps auxProduces a list of every process
↓ piped into
grep nginxFilters it down to just nginx
Redirects: > and >> #
echo "Hello Linux" > message.txt # overwrites the file
echo "Second message" > message.txt # replaces previous content entirely
echo "First line" > notes.txt
echo "Second line" >> notes.txt # >> appends instead
| Symbol | Behavior |
|---|---|
> | Overwrite the file |
>> | Append to the file |
Finding your own way: man and history #
You are not expected to memorize every flag of every command. man is how you look it up:
man ls
man chmod
man ssh # press 'q' to exit
history shows what you’ve already run — useful both for reference and for rerunning something without retyping it:
history
!102 # re-run command number 102 from history
Ctrl + R # search history interactively
And exit closes the current shell — or, if you’re connected over SSH, disconnects you from the remote machine.