# ------------------------------------------------- # (Some) Common (linux) commands # 1st: Open a shell "Terminal" # 2nd: here some common commands: ## pwd => “where am I ?” … ie, show the full path for current folder ## ls -l => list current file & sub-folders in current folder ## lsusb => list current USB devices “known” by your linux system ## ls -la /dev/|grep stlink => list and filter, from folder “/dev/”, any device named “stlink” ## cp => copy a to it’s target destination (could be a new file name, or a folder) ## date => get current date & time ## cat => show file content ## mkdir => will create a folder named “YourFolder” (MaKeDirectory) ## rmdir => to delete a folder (ReMoveDirectory) ## rm => to delete a file (ReMove) ## cd => “enter/go into” your folder (ChangeDirectory) ## cd .. => go back to the previous level folder (it’s “father”) ## ./ => execute the script “YourScriptName” from current folder (the “./” means “the current folder where I’m typing my commands” - thus, the “../” refers to the father/upper folder) ## git init . => create (prepare) your folder to get a “git” repository “installed” ## git fetch => “tell (prepare) your current folder” to pre-read the content of a distant git repository URL ## git merge FETCH_HEAD => “merge” (ie copy in place) the git URL content into your folder ## sudo => the “sudo” order allow you to execute commands as “root” user ## sudo apt => update/install Linux package(s) (ie, programs, application, scripts, …) ## wget => download locally content from an URL ## export VarName= => create an environment variable named “VarName” and assign its content ## make => perform a code compilation ## cd ~ => go back to your "home" user folder # ------------------------------------------------- # ex: ## ubuntu@UbuntuMini:~/game-and-watch/game-and-watch-backup$ pwd ## /home/ubuntu/game-and-watch/game-and-watch-backup ## ubuntu@UbuntuMini:~/game-and-watch/game-and-watch-backup$ ls -l ## total 84 ## -rwxr-x--- 1 ubuntu ubuntu 8493 nov. 17 17:04 0_menu.sh ## -rwxrwxr-x 1 ubuntu ubuntu 841 nov. 17 11:46 1_sanity_check.sh ## [...] ## ubuntu@UbuntuMini:~/game-and-watch/game-and-watch-backup$ cat 1_sanity_check.sh ## #!/bin/bash ## ## source config.sh $@ ## ## echo "Running sanity checks..." ## [...] ## ubuntu@UbuntuMini:~/game-and-watch/game-and-watch-backup$ cd .. ## ubuntu@UbuntuMini:~/game-and-watch$ ## ubuntu@UbuntuMini:~/game-and-watch$ pwd ## /home/ubuntu/game-and-watch ## ubuntu@UbuntuMini:~/game-and-watch$ mkdir temp ## ubuntu@UbuntuMini:~/game-and-watch$ ls -l ## [...] ## drwxrwxr-x 11 ubuntu ubuntu 4096 nov. 17 17:05 game-and-watch-backup ## [...] ## drwxrwxr-x 2 ubuntu ubuntu 4096 nov. 17 16:42 temp ## [...] ## ubuntu@UbuntuMini:~/game-and-watch$ cd temp ## ubuntu@UbuntuMini:~/game-and-watch/temp$ pwd ## /home/ubuntu/game-and-watch/temp ## ubuntu@UbuntuMini:~/game-and-watch/temp$ cp ../game-and-watch-backup/1_sanity_check.sh 1_copied.sh ## ubuntu@UbuntuMini:~/game-and-watch/temp$ ls -l ## total 35084 ## drwxrwxr-x 2 ubuntu ubuntu 4096 nov. 17 17:24 ./ ## drwxrwxr-x 11 ubuntu ubuntu 4096 nov. 17 17:07 ../ ## -rwxrwxr-x 1 ubuntu ubuntu 841 nov. 17 17:24 1_copied.sh*