Myria is the other word for 'many', alternative to 'poly'
This guide continues from the Linux basics and introduces terminal shortcuts, text editors, text processing, remote server access, SSH keys, Git, and GitHub.
| Shortcut | Action |
|---|---|
Ctrl+C |
Stop the current command |
Ctrl+D |
End input or exit the terminal |
Ctrl+L |
Clear the screen |
Ctrl+R |
Search command history |
Ctrl+A |
Move to the start of the line |
Ctrl+E |
Move to the end of the line |
Ctrl+U |
Delete before the cursor |
Ctrl+K |
Delete after the cursor |
Ctrl+W |
Delete the previous word |
Tab |
Autocomplete |
| Up arrow | Previous command |
| Down arrow | Next command |
View history:
historyRun the previous command:
!!Use sudo with the previous command:
sudo !!more application.logControls:
Space— next pageEnter— next lineq— quit
less application.logUseful controls:
| Key | Action |
|---|---|
| Arrow keys | Move |
| Space | Next page |
b |
Previous page |
g |
Beginning |
G |
End |
/error |
Search forward |
n |
Next result |
N |
Previous result |
q |
Quit |
Use less for large files and logs.
Nano is recommended for beginners.
Open a file:
nano notes.txtCommon shortcuts:
| Shortcut | Action |
|---|---|
Ctrl+O |
Save |
Enter |
Confirm filename |
Ctrl+X |
Exit |
Ctrl+W |
Search |
Ctrl+\ |
Find and replace |
Ctrl+K |
Cut line |
Ctrl+U |
Paste |
Alt+U |
Undo |
Alt+E |
Redo |
In Nano, the ^ symbol means Ctrl.
For example:
^X
means:
Ctrl+X
Open a file:
vi notes.txtor:
vim notes.txtVim has modes.
Press:
i
Then type normally.
Other insertion commands:
| Key | Action |
|---|---|
i |
Insert before cursor |
a |
Insert after cursor |
o |
New line below |
O |
New line above |
Press:
Esc
Use Normal Mode for navigation and commands.
After pressing Esc:
:wSave.
:qQuit.
:wqSave and quit.
:q!Quit without saving.
| Key | Action |
|---|---|
h |
Left |
j |
Down |
k |
Up |
l |
Right |
w |
Next word |
b |
Previous word |
0 |
Start of line |
$ |
End of line |
gg |
Beginning of file |
G |
End of file |
| Command | Action |
|---|---|
x |
Delete character |
dd |
Delete line |
yy |
Copy line |
p |
Paste |
u |
Undo |
Ctrl+R |
Redo |
/word |
Search |
n |
Next result |
The minimum Vim survival commands are:
i
Esc
:wq
:q!
sed is a stream editor used to transform text.
sed 's/old/new/' notes.txtReplace all matches on each line:
sed 's/old/new/g' notes.txtsed -i 's/old/new/g' notes.txtCreate a backup:
sed -i.bak 's/old/new/g' notes.txtThis may create:
notes.txt
notes.txt.bak
sed -n '1,10p' notes.txtDelete line 3:
sed '3d' notes.txtDelete lines 3 through 8:
sed '3,8d' notes.txtDelete blank lines:
sed '/^$/d' notes.txtGiven:
PORT=3000
Change it to:
PORT=8080
Command:
sed -i.bak 's/^PORT=.*/PORT=8080/' .envAlways inspect the file before using sed -i.
awk works well with columns and structured text.
Given:
jose developer active
anna designer active
mark tester inactive
Print the first column:
awk '{print $1}' users.txtPrint the first and second columns:
awk '{print $1, $2}' users.txtGiven:
jose,developer,active
anna,designer,active
Print the first field:
awk -F',' '{print $1}' users.csvPrint name and role:
awk -F',' '{print $1, $2}' users.csvPrint rows containing active:
awk '$3 == "active" {print $1}' users.txtShow process IDs and commands:
ps aux | awk '{print $2, $11}'Show disk usage columns:
df -h | awk '{print $1, $5, $6}'wc -l application.logsort names.txtNumeric sorting:
sort -n numbers.txtsort names.txt | uniqCount duplicates:
sort names.txt | uniq -ccut -d',' -f1 users.csvecho "hello world" | tr ' ' '_'Convert lowercase to uppercase:
echo "hello" | tr 'a-z' 'A-Z'echo "Deployment complete" | tee deployment.logAppend:
echo "Second deployment" | tee -a deployment.logCreate a script:
nano hello.shContents:
#!/usr/bin/env bash
set -euo pipefail
echo "Welcome to FWDP Academy"
echo "Current user: $(whoami)"
echo "Current directory: $(pwd)"Make it executable:
chmod +x hello.shRun it:
./hello.shThe first line is called a shebang:
#!/usr/bin/env bashDisplay common variables:
echo "$HOME"
echo "$USER"
echo "$PATH"Create a temporary variable:
APP_ENV=developmentExport it:
export APP_ENV=developmentDisplay it:
echo "$APP_ENV"Common shell configuration files:
~/.bashrc
~/.profile
~/.zshrc
Reload Bash configuration:
source ~/.bashrcNever commit passwords, tokens, or private keys into Git repositories.
SSH allows secure access to another computer.
Connect to a server:
ssh username@server.example.comUsing an IP address:
ssh jose@192.168.1.50Using a custom port:
ssh -p 2222 jose@server.example.comExit the remote server:
exitThe first connection may ask you to verify the server fingerprint. Confirm it only when you trust the server.
Generate an Ed25519 key:
ssh-keygen -t ed25519 -C "your-email@example.com"The default files are:
~/.ssh/id_ed25519
~/.ssh/id_ed25519.pub
The private key is:
~/.ssh/id_ed25519
Never share it.
The public key is:
~/.ssh/id_ed25519.pub
Display it:
cat ~/.ssh/id_ed25519.pubRecommended private-key permission:
chmod 600 ~/.ssh/id_ed25519Start the SSH agent:
eval "$(ssh-agent -s)"Add the private key:
ssh-add ~/.ssh/id_ed25519List loaded keys:
ssh-add -lUse:
ssh-copy-id username@server.example.comThen connect:
ssh username@server.example.comThe server normally stores approved keys in:
~/.ssh/authorized_keys
Recommended permissions:
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keysCreate:
nano ~/.ssh/configExample:
Host fwdp-server
HostName server.example.com
User jose
Port 22
IdentityFile ~/.ssh/id_ed25519Set permissions:
chmod 600 ~/.ssh/configConnect using:
ssh fwdp-serverLocal file to server:
scp report.txt jose@server.example.com:/home/jose/Server file to local computer:
scp jose@server.example.com:/home/jose/report.txt .Copy a directory:
scp -r project/ jose@server.example.com:/home/jose/rsync -av project/ jose@server.example.com:/home/jose/project/With progress and compression:
rsync -avzP project/ jose@server.example.com:/home/jose/project/Be careful with:
--deleteIt removes destination files that are missing from the source.
Git is a version control system.
GitHub is an online platform that hosts Git repositories.
Git helps developers:
- Track changes
- Create branches
- Review history
- Work with teams
- Restore earlier versions
- Share projects
Set your name:
git config --global user.name "Jose Palala"Set your email:
git config --global user.email "your-email@example.com"Set the default branch:
git config --global init.defaultBranch mainView configuration:
git config --listmkdir demo-project
cd demo-project
git initCreate a file:
echo "# Demo Project" > README.mdCheck status:
git statusStage the file:
git add README.mdCommit it:
git commit -m "Add initial README"Working Directory
↓ git add
Staging Area
↓ git commit
Repository History
Common workflow:
git status
git diff
git add .
git commit -m "Add login validation"git statusgit add app.jsStage all changes:
git add .Interactively stage selected changes:
git add -pgit commit -m "Fix invoice calculation"Good commit messages describe the change clearly.
git logCompact history:
git log --onelineVisual branch history:
git log --oneline --graph --decorate --allUnstaged changes:
git diffStaged changes:
git diff --stagedCreate and switch to a branch:
git switch -c feature/loginReturn to the main branch:
git switch mainMerge the feature:
git merge feature/loginDelete the merged branch:
git branch -d feature/loginCommon branch names:
feature/login
fix/payment-total
docs/installation-guide
refactor/user-service
A conflict may look like:
<<<<<<< HEAD
Current branch version
=======
Incoming branch version
>>>>>>> feature/login
To resolve it:
- Open the file.
- Choose or combine the correct content.
- Remove the conflict markers.
- Test the result.
- Stage the file.
- Commit the resolution.
git add conflicted-file.txt
git commitDiscard unstaged changes:
git restore app.jsUnstage a file:
git restore --staged app.jsChange the latest commit:
git commit --amendReverse an old commit safely:
git revert COMMIT_IDDangerous commands include:
git reset --hard
git clean -fdThese may permanently remove uncommitted work.
Create:
nano .gitignoreExample:
node_modules/
vendor/
.env
*.log
dist/
build/
.idea/
.vscode/Do not commit:
- Passwords
- API keys
- SSH private keys
- Database backups
- Environment files containing secrets
Check whether a file is already tracked:
git statusCopy your public key:
cat ~/.ssh/id_ed25519.pubAdd it to your GitHub account under SSH keys.
Test the connection:
ssh -T git@github.comClone a repository through SSH:
git clone git@github.com:username/project.gitCreate an empty repository on GitHub, then run:
git remote add origin git@github.com:username/project.gitCheck the remote:
git remote -vPush the main branch:
git push -u origin mainFuture pushes can use:
git pushDownload and merge changes:
git pullDownload changes without merging:
git fetchReview remote changes:
git log --oneline main..origin/mainA safer team habit is:
git status
git fetch
git pullMake sure local work is committed or safely stored before pulling major changes.
A simple team workflow is:
git switch main
git pull
git switch -c feature/new-pageMake changes, then:
git status
git add .
git commit -m "Add new page"
git push -u origin feature/new-pageAfter pushing:
- Open GitHub.
- Create a pull request.
- Request review.
- Resolve comments.
- Merge the pull request.
- Update your local
mainbranch.
git switch main
git pullgrep -Rni "searchText" .find . -type f -name "*.log"sed -i.bak 's/old/new/g' file.txtawk -F',' '{print $1, $2}' users.csvtail -f application.logssh user@serverrsync -avzP project/ user@server:/var/www/project/git log --oneline --graph --decorate --allgit diff --stagedgit switch -c feature/example- Check your current folder before deleting files.
pwd
ls -la-
Back up files before using
sed -i. -
Never share SSH private keys.
-
Never commit passwords or API keys.
-
Avoid
sudounless required. -
Read commands before pasting them into a terminal.
-
Use
git statusfrequently. -
Commit small, understandable changes.
-
Test code before pushing it.
-
Treat production servers more carefully than local development machines.