The CLI (Command-line interface) is a developer's friend and power tool. Learn some of the most important commands and see how the CLI can supercharge your workday.
You'll learn some basic bash programming and produce a simple deployment script for a remote location.
This repository contains a link to a Google Presentation with a quick introduction to the CLI, some tips on useful tools and exercises. Happy hacking!
You'll only need the Bash shell:
- Linux/MacOS: Bash is already included
- Windows: Install Git for Windows - Remember to opt in for Git Bash when installing
- Start by cloning this repository into a folder on your computer. If you've never used git before, you can alternatively use the the green "Code" button to the top right, and then select "Download zip". Unzip the downloaded zip file (make sure to remember where you put it).
- Although you have this
README.md
file on your computer, it's easier to read it on GitHub with formatting. We therefore recommend you keep a web browser tab open with the exercise tasks. - Start by opening exercise 1.
- Remember to ask an instructor if you're stuck.
❗ Hottest tip: Google is your friend. You will need to google a lot as you dive into the exercises!
- Exercise 1 - Getting started
- Exercise 2 - Basics of the shell
- Exercise 2 - Scripting
- Exercise 4 - Using pipelines and redirects
- Exercise 5 - Number guessing game
ls
: what's in this directory? ("list")pwd
: where am I standing in the file system? ("print working directory")cd
: take me to indicated directory ("change directory")find
: find a file from given directory in the file tree
history
: show me the commands I've runtail
: read me the last lines of a filehead
: read me the first lines of a fileless
: non-editable view of a filecat
: list contents of a file to standard outgrep
: search for a string of characters in a file using given regular expression
mkdir
: make a directory ("make dir")cp
: copy a file or directory ("copy")mv
: move a file or directory ("move")rm
: delete a file or directory ("remove")chmod
: change file permissions ("change mode")touch
: change last-modified timestamp of a file without editing it
echo
: print to screen (thinkSystem.out.println
)|
: send the output (pipe the output) to the next command>
and<
: redirecting input and output streamsfor
if
- variables
- Google is, as always, your friend
man <command>