Skip to content

Latest commit

 

History

History
33 lines (30 loc) · 1.78 KB

shell_and_terminal.md

File metadata and controls

33 lines (30 loc) · 1.78 KB

The Shell and Terminal

The shell is a program used on the command-line interface (on Terminal) to read commands and run other programs. The command line on Terminal starts with the name of the computer followed by the name of the user. Type commands after the prompt ($ for Linux).

Software Carpentry tutorial on the shell

Git Commands in Terminal

git config -h show list of GitHub commands
git config --list list settings for GitHub account
git init make directory on computer a GitHub repo
git clone clone GitHub repo to computer
git status show status of a project
git add <file_name> add file from computer to GitHub, needs to be committed and pushed
git commit - m "<message>" add commit to GitHub, needs to be pushed
git push push repo to GitHub, final step
git log shows history of project by commit
git diff difference between current file and last saved file, can be edited to show difference between two chosen files
git checkout -- <file> restore old version of a file, also can be used to switch branches
git branch show current branch
git pull pull updated files from GitHub to computer

Commands in Terminal

mkdir <directory_name> make directory
cd <directory_name> navigate into directory
ls list contents of directory
cat <file_name> display contents of file in Terminal
touch <file_name> make new file
rm <file_name> remove file
nano <file_name> create and/or edit a file, use ctrl-o to save and ctrl-x to exit
cp <file1_name> <file2_name> copy one file into another
*.txt select all files ending with txt (can be any ending)
echo returns input as output, i.e. returning value of variable
clear clear Terminal window
$VAR value of variable