Перейти к содержимому

Unix / Linux Commands #10: Daily Workflows, Aliases and Safety Habits (Series Finale)

Code & Test Automation

0:00 / 0:00

Unix / Linux Commands #10: Daily Workflows, Aliases and Safety Habits (Series Finale)

2 просмотра · 1 дн. назад
Code & Test Automation
21 подписчик
2 просмотра · 1 дн. назад
Code & Test Automation |    / @codetestautomation   The series finale: combine the commands into a real daily workflow in a real bash terminal with real output. Orient with pwd and ls -la, move with cd and cd -, read with less and tail -f, search with grep -rn and find, and answer questions with pipes like cut | sort | uniq -c | sort -rn. Create aliases (ll, .., gs), see why they vanish in a new shell, and make them permanent in ~/.bashrc or ~/.zshrc. Then build the safety habits: look before rm, preview wildcards with echo, rm -i, cp -i, --help and man, backups with tar, and testing destructive commands on a copy. Next: a new series on k6 load testing. In this video: pwd, ls -la, cd, cd -, Tab, less /ERROR, tail -f grep -rn --exclude-dir=.git, find -name, a cut | sort | uniq -c pipeline, history and Ctrl+R alias ll='ls -lah', alias ..='cd ..', alias gs='git status', alias, type ~/.bashrc backup, ›› vs ›, source, echo $SHELL (zsh uses ~/.zshrc) safety: pwd and ls first, echo rm *.log, rm -i, cp -i, du --help, man rm tar -czf backups, test a bulk rename on a copy, a two-week practice plan Video 10 of 10 in the Unix / Linux Commands series, for freshers and experienced engineers on Linux, macOS and most Unix systems: navigation, file operations, viewing and searching files, permissions, pipes and redirection, processes, disk tools and daily workflows. Almost every minute is a real terminal session with real output. CHAPTERS 0:00 Introduction 0:58 Orient: pwd and ls -la 1:22 Move: cd into a project 1:44 cd - : jump back 1:58 Inspect: less and search 2:16 Watch: tail -f a live log 2:37 Search: grep -rn 2:59 Locate: find 3:17 Combine: a pipeline 3:58 history and Ctrl+R 4:29 alias ll='ls -lah' 4:56 alias ..='cd ..' 5:09 alias gs='git status' 5:35 git restore and gs again 5:50 List aliases: alias and type 6:14 unalias and command 6:38 Aliases vanish in a new shell 6:56 Back up ~/.bashrc first 7:23 Append the aliases 7:45 source and test 8:03 bash or zsh? echo $SHELL 8:28 Safety: look before rm 8:59 Preview a wildcard with echo 9:17 rm -i: ask first 9:35 cp -i and mv -i 9:57 Forgot an option? --help and man 10:13 man rm and search 10:34 Back up before bulk changes 10:57 Test on a copy: preview 11:23 Test on a copy: run 11:46 A practice plan 12:31 Your history so far 12:44 Recap 13:52 Next episode HOW THE DEMOS WERE MADE Everything between the title card and the recap is a live screen recording of a real bash 5.2 shell in xfce4-terminal on Debian Linux (GNU coreutils 9.7). Every command was typed at a human pace and every line of output is the real output; nothing was edited in afterwards. The shell runs in a private practice sandbox: an unprivileged Linux user, mount and PID namespace whose home folder, /home/learner, holds only the practice files created by the mklab.sh script in the project zip, and whose host name is unix-lab. No sudo was used, and no command touched anything outside the practice folder. This minimal machine has no man-db, so the man command here is a small wrapper that shows the official GNU manual pages with mandoc and the real less pager. Keys pressed in the terminal appear in on-screen badges with the macOS Terminal keys and the Linux keys. When macOS or BSD tools use different options, the macOS form is shown as TYPED ONLY: typed on screen, never run, and cancelled with Ctrl+C, so no output is ever invented. CORRECTIONS TO THE COURSE NOTES Aliases typed at the prompt last only for that shell; put them in ~/.bashrc (bash) or ~/.zshrc (zsh, the macOS default), back the file up first, append with ›› (not ›), then run source ~/.bashrc. alias gs='git status' only works inside a git repository (the practice folder's projects/shopkart is one when git is installed); outside a repository git prints 'not a git repository'. 'Always check the path before rm -rf' in practice: run pwd and ls on the exact path, preview wildcards with echo rm ..., and use rm -i when unsure. There is no undo or recycle bin in the terminal. grep -rn also searches hidden folders such as .git; add --exclude-dir=.git when searching a repository. tail -f stops following when you press Ctrl+C; it does not stop the program writing the log. PRACTICE 1. alias ll='ls -lah', then ll and type ll. 2. Back up ~/.bashrc, append the alias with ››, source it, and test it in a new bash. 3. echo rm logs/old/*.log, then rm -i logs/old/*.log. 4. For two weeks, use the terminal instead of the file manager for 15 minutes a day. Practice tip: open a terminal on Linux, macOS or WSL, make a practice folder, and type every command right after you see it. That completes the Unix / Linux Commands series: all 10 videos. #Linux #Unix #Bash #LinuxCommands #CodeAndTestAutomation Subscribe to Code & Test Automation for more Linux, Java, coding and test automation tutorials:    / @codetestautomation