Skip to content

Instantly share code, notes, and snippets.

@marianabocoi
Last active December 2, 2018 16:51
Show Gist options
  • Save marianabocoi/abd8f5b87084a557c40a8314df4c5a79 to your computer and use it in GitHub Desktop.
Save marianabocoi/abd8f5b87084a557c40a8314df4c5a79 to your computer and use it in GitHub Desktop.
# Hello World
# Where am I
pwd
# Change Directory
cd <dir-name>
# Go one level up
cd ..
# Take me home
cd
# absolute path
cd /Users/mariana.bocoi/projects/pink
# relative path
cd ../../../..
#clear termil
clear
#List everything
ls -a
#list everything as a list
ls -l
# list everything as list
ls -l -a
#or
ls -la
## autocomplete = press tab
## press up and down arrows to go through history
# asking for help
man <command>
<command> -h
<command> --help
<command>
help command
# when nothing works google it or maybe before :D
#making dir and moving around
mkdir documents
ls
# out: documents
ls -l
# total 0
# drwxr-xr-x 2 mariana.bocoi staff 64 Dec 2 11:45 documents
cd documents/
pwd
# out:
/Users/mariana.bocoi/projects/pink/documents
# make file
touch <filename.extension>
# list file contents
cat <filename.extension>
# remove file
rm <filename.extension>
#remove directory
rm -r <directory name>
# rename file
mv faries.yay cats.html
# move files
mv cats.html ../kittens/
# list something
echo 'Hello World!'
###first bash script:
#!/usr/bin/env bash
echo 'Hello World!'
# make executable
chmod +x
## Vim
@emernichiobhain
Copy link

vim cats.html => open vim editor (in terminal)
: in command mode
:q! to quit editor and discard any changes
i => insert mode
esc to escape insert mode
: wq write and quit (:x does the same)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment