Files
GameAndWatchScripts/LinuxCommandsForDummies.txt
2021-11-19 00:04:52 +01:00

66 lines
3.5 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -------------------------------------------------
# (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 <SourceFile> <Destination> => copy a <File> to its target destination (could be a new file name, or a folder)
## date => get current date & time
## cat <YourFile> => show file content
## mkdir <YourFolder> => will create a folder named “YourFolder” (MaKeDirectory)
## rmdir <YourFolder> => to delete a folder (ReMoveDirectory)
## rm <YourFile> => to delete a file (ReMove)
## cd <YourFolder> => “enter/go into” your folder (ChangeDirectory)
## cd .. => go back to the previous level folder (its “father”)
## ./<YourScriptName> => execute the script “YourScriptName” from current folder (the “./” means “the current folder where Im 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 <URL> => “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 <YourCommands> => the “sudo” order allow you to execute commands as “root” user
## sudo apt <RequestedPackages> => update/install Linux package(s) (ie, programs, application, scripts, …)
## wget <URL> => download locally content from an URL
## export VarName=<VarContent> => create an environment variable named “VarName” and assign its content
## make <Commands> => 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*