Key/Command
Description
cd [folder]
Change directory e.g. cd Documents
cd
Home directory
cd ~
Home directory
cd /
Root of drive
cd -
Previous directory
ls
Short listing
ls -l
Long listing
ls -a
Listing incl. hidden files
ls -lh
Long listing with Human readable file sizes
ls -R
Entire content of folder recursively
sudo [command]
Run command with the security privileges of the superuser (Super User DO)
open [file]
Opens a file ( as if you double clicked it )
top
Displays active processes. Press q to quit
nano [file]
Opens the file using the nano editor
vim [file]
Opens the file using the vim editor
clear
Clears the screen
reset
Resets the terminal display

keycommand: ctrl + c
back to folder( from div. commands)

DIRECTORY MANAGEMENT

Key/Command
Description
mkdir [dir]
Create new directory
mkdir -p [dir]/[dir]
Create nested directories
rmdir [dir]
Remove directory ( only operates on empty directories )
rm -R [dir]
Remove directory and contents
less [file]
Output file content delivered in screensize chunks
[command] > [file]
Push output to file, keep in mind it will get overwritten
[command] >> [file]
Append output to existing file
[command] < [file]
Tell command to read content from a file

GIT COMMANDS

https://confluence.atlassian.com/bitbucketserver/basic-git-commands-776639767.html
https://help.github.com
Key/Command
Description
git init
initialiser git i den valgte mappe
git status
see what branch you’re on
git —version
viser git version
git config —global user.username <username>
Add your GitHub username to your configuration:
git remote add [remotename] [urlfromgithub]
Your local repository now knows where your remote one named 'origin' lives on GitHub's servers
git remote -v
view current remotes
git remote rm [remotename]
remove remote
git add [file]
add(save) to commit
git commit -m [“message”]
commit the changes
git pull [remotename] [branchname]
Tell command to read content from a file
git push [remotename] [branchname]
push changes
git clone [urlfromgithub]
clone project
git branch [branchname]
create a new branch (local)
git checkout [branchname]
go to a new branch
git push origin <branchname>
Push the branch to your remote repository, so others can use it:
rm -rf .git
remove git from folder ( navigate to folder first: cd myFolder)