Skip to content

Instantly share code, notes, and snippets.

@tomatohammado
Last active November 13, 2017 23:04
Show Gist options
  • Select an option

  • Save tomatohammado/588c5d9e9f6072b978210a56a7705dc2 to your computer and use it in GitHub Desktop.

Select an option

Save tomatohammado/588c5d9e9f6072b978210a56a7705dc2 to your computer and use it in GitHub Desktop.
day 1 exercises, working with files
Last login: Mon Nov 13 12:03:52 on console
-bash: export: `Code.app/Contents/Resources/app/bin': not a valid identifier
GAs-MacBook-Air:~ ga$ ls
Applications Documents Dropbox Movies Pictures
Desktop Downloads Library Music Public
GAs-MacBook-Air:~ ga$ ls /
Applications home
Library installer.failurerequests
Network macOS_SDK
System net
Users private
Volumes sbin
bin tmp
cores usr
dev var
etc vm
GAs-MacBook-Air:~ ga$ cd Do
Documents/ Downloads/
GAs-MacBook-Air:~ ga$ cd Documents/
GAs-MacBook-Air:Documents ga$ cd
GAs-MacBook-Air:~ ga$ cd Documents/
GAs-MacBook-Air:Documents ga$ ls
Screen Shot 2017-11-13 at 1.28.28 PM.png
GAs-MacBook-Air:Documents ga$ touch hey.txt
GAs-MacBook-Air:Documents ga$ ls
Screen Shot 2017-11-13 at 1.28.28 PM.png
hey.txt
GAs-MacBook-Air:Documents ga$ cd ~/Downloads/World
GAs-MacBook-Air:World ga$ ls
Africa Australia North_America
Asia Europe South_America
GAs-MacBook-Air:World ga$ ls -a
. .pacific_ocean.jpg Europe
.. .southern_ocean.jpg North_America
.arctic_ocean.jpg Africa South_America
.atlantic_ocean.jpg Asia
.indian_ocean.jpg Australia
GAs-MacBook-Air:World ga$ ls Africa/ -a
ls: -a: No such file or directory
Africa/:
Cameroon Ethiopia Kenya Zimbabwe
GAs-MacBook-Air:World ga$ ls -a Africa/
. Cameroon Kenya
.. Ethiopia Zimbabwe
GAs-MacBook-Air:World ga$ ls Asia/ -a
ls: -a: No such file or directory
Asia/:
India Japan Vietnam
GAs-MacBook-Air:World ga$ ls Australia/ -a
ls: -a: No such file or directory
Australia/:
Australia
GAs-MacBook-Air:World ga$ ls -a Australia/
. .. Australia
GAs-MacBook-Air:World ga$ ls -a Asia/
. .. India Japan Vietnam
GAs-MacBook-Air:World ga$ ls -a North_America/
. .. Canada United_States
GAs-MacBook-Air:World ga$ ls -a South_America/
. .. Argentina Brazil Chile
GAs-MacBook-Air:World ga$ grep .carmen_sandiego.png
^C
GAs-MacBook-Air:World ga$ ls
Africa Australia North_America
Asia Europe South_America
GAs-MacBook-Air:World ga$ ls -a Africa/
. Cameroon Kenya
.. Ethiopia Zimbabwe
GAs-MacBook-Air:World ga$ ls -a Africa/Cameroon/
. .. Kribi.jpg
GAs-MacBook-Air:World ga$ ls -a Africa/Ethiopia/
. Lalibela.jpg
.. blue_nile_falls.jpg
GAs-MacBook-Air:World ga$ ls -a Africa/Kenya
. .. Nairobi.pdf
GAs-MacBook-Air:World ga$ ls -a Africa/Zimbabwe/
. .. victoria_falls.jpg
GAs-MacBook-Air:World ga$ ls
Africa Australia North_America
Asia Europe South_America
GAs-MacBook-Air:World ga$ ls -a Asia/
. .. India Japan Vietnam
GAs-MacBook-Air:World ga$ ls -a Asia/India/
. .. jaipur.jpg taj_mahal.jpg
GAs-MacBook-Air:World ga$ ls -a Asia/Japan/
. Meiji_Shrine.jpg yoyogi_park.jpg
.. mount_fuji.jpg
GAs-MacBook-Air:World ga$ ls -a Asia/Vietnam/
. ho_chi_minh_city.jpg
.. po_nagar.jpg
GAs-MacBook-Air:World ga$ ls -a Australia/
. .. Australia
GAs-MacBook-Air:World ga$ ls -a Australia/Australia/
. sydney.jpg
.. sydney_opera_house.jpg
GAs-MacBook-Air:World ga$ ls -a Europe/
. France Spain
.. Italy
.carmen_sandiego.png Luxembourg
GAs-MacBook-Air:World ga$ ls -a Europe/France/
. eiffel_tower.jpg
.. mona_lisa.jpg
GAs-MacBook-Air:World ga$ open .arctic_ocean.jpg
GAs-MacBook-Air:World ga$ pwn --help
-bash: pwn: command not found
GAs-MacBook-Air:World ga$ pwd --help
-bash: pwd: --: invalid option
pwd: usage: pwd [-LP]
GAs-MacBook-Air:World ga$ man pwd
GAs-MacBook-Air:World ga$ man ls
GAs-MacBook-Air:World ga$ man cd
GAs-MacBook-Air:World ga$ cd ~
GAs-MacBook-Air:~ ga$
Display all 1576 possibilities? (y or n)
GAs-MacBook-Air:~ ga$
Display all 1576 possibilities? (y or n)
GAs-MacBook-Air:~ ga$ touch joke.txt
GAs-MacBook-Air:~ ga$ ls
Applications Downloads Movies Public
Desktop Dropbox Music joke.txt
Documents Library Pictures
GAs-MacBook-Air:~ ga$ atom joke.txt
GAs-MacBook-Air:~ ga$ open joke.txt
GAs-MacBook-Air:~ ga$ mkdir funny_things
GAs-MacBook-Air:~ ga$ mv joke.txt bar_joke.txt
GAs-MacBook-Air:~ ga$ ls
Applications Downloads Movies Public
Desktop Dropbox Music bar_joke.txt
Documents Library Pictures funny_things
GAs-MacBook-Air:~ ga$ mv bar_joke.txt funny_things/
GAs-MacBook-Air:~ ga$ ls
Applications Downloads Movies Public
Desktop Dropbox Music funny_things
Documents Library Pictures
GAs-MacBook-Air:~ ga$ cat funny_things/bar_joke.txt
a man walks into a bar.
The other one ducks.GAs-MacBook-Air:~ ga$ touch bar_joke.txt
GAs-MacBook-Air:~ ga$ mv bar_joke.txt funny_things/
GAs-MacBook-Air:~ ga$ ls funny_things/
bar_joke.txt
GAs-MacBook-Air:~ ga$ cat funny_things/bar_joke.txt
GAs-MacBook-Air:~ ga$ man mv
GAs-MacBook-Air:~ ga$ mkdir serious_things
GAs-MacBook-Air:~ ga$ touch serious_things/not_a_joke.txt
GAs-MacBook-Air:~ ga$ rmdir serious_things/
rmdir: serious_things/: Directory not empty
GAs-MacBook-Air:~ ga$ rmdir -f serious_things/
rmdir: illegal option -- f
usage: rmdir [-p] directory ...
GAs-MacBook-Air:~ ga$ rm -r serious_things/
GAs-MacBook-Air:~ ga$ ls
Applications Downloads Movies Public
Desktop Dropbox Music funny_things
Documents Library Pictures
GAs-MacBook-Air:~ ga$ mv Downloads/World ~/
GAs-MacBook-Air:~ ga$ ls
Applications Downloads Movies Public
Desktop Dropbox Music World
Documents Library Pictures funny_things
GAs-MacBook-Air:~ ga$ cd World/
GAs-MacBook-Air:World ga$ mkdir Antarctica
GAs-MacBook-Air:World ga$ ls
Africa Asia Europe South_America
Antarctica Australia North_America
GAs-MacBook-Air:World ga$ man mv
GAs-MacBook-Air:World ga$ ls South_America/
Argentina Brazil Chile
GAs-MacBook-Air:World ga$ mv South_America/Argentina/ North_America/
GAs-MacBook-Air:World ga$ mv South_America/Brazil/ North_America/
GAs-MacBook-Air:World ga$ mv South_America/Chile/ North_America/
GAs-MacBook-Air:World ga$ mv North_America/ Americas/
GAs-MacBook-Air:World ga$ ls
Africa Antarctica Australia South_America
Americas Asia Europe
GAs-MacBook-Air:World ga$ ls Americas/
Argentina Brazil Canada Chile United_States
GAs-MacBook-Air:World ga$ rmdir South_America/
GAs-MacBook-Air:World ga$ ls
Africa Antarctica Australia
Americas Asia Europe
GAs-MacBook-Air:World ga$ cd .
GAs-MacBook-Air:World ga$ cd ..
GAs-MacBook-Air:~ ga$ cd .
GAs-MacBook-Air:~ ga$ mkdir fundamentals/
GAs-MacBook-Air:~ ga$ ls
Applications Downloads Movies Public funny_things
Desktop Dropbox Music World
Documents Library Pictures fundamentals
GAs-MacBook-Air:~ ga$ rmdir funny_things/
rmdir: funny_things/: Directory not empty
GAs-MacBook-Air:~ ga$ rm -r funny_things/
GAs-MacBook-Air:~ ga$ ls
Applications Downloads Movies Public
Desktop Dropbox Music World
Documents Library Pictures fundamentals
GAs-MacBook-Air:~ ga$ ls World/Americas/
Argentina Brazil Canada Chile United_States
GAs-MacBook-Air:~ ga$ mkdir wdi-fundamentals
GAs-MacBook-Air:~ ga$ mv wdi-fundamentals/ fundamentals/
GAs-MacBook-Air:~ ga$ ls fundamentals/
wdi-fundamentals
GAs-MacBook-Air:~ ga$ rmdir fundamentals/wdi-fundamentals/
GAs-MacBook-Air:~ ga$ ls fundamentals/
GAs-MacBook-Air:~ ga$ rmdir fundamentals/
GAs-MacBook-Air:~ ga$ mkdir wdi-fundamentals
GAs-MacBook-Air:~ ga$ mv wdi-fundamentals/ fundamentals/
GAs-MacBook-Air:~ ga$ ls
Applications Downloads Movies Public
Desktop Dropbox Music World
Documents Library Pictures fundamentals
GAs-MacBook-Air:~ ga$ ls fundamentals/
GAs-MacBook-Air:~ ga$ git --version
git version 2.15.0
GAs-MacBook-Air:~ ga$ mkdir test
GAs-MacBook-Air:~ ga$ ls
Applications Downloads Movies Public test
Desktop Dropbox Music World
Documents Library Pictures fundamentals
GAs-MacBook-Air:~ ga$ mkdir ga
GAs-MacBook-Air:~ ga$ mv World/ ga/
GAs-MacBook-Air:~ ga$ ls
Applications Downloads Movies Public test
Desktop Dropbox Music fundamentals
Documents Library Pictures ga
GAs-MacBook-Air:~ ga$ ls ga/
World
GAs-MacBook-Air:~ ga$ cd test/
GAs-MacBook-Air:test ga$ mkdir git_test/
GAs-MacBook-Air:test ga$ cd git_test/
GAs-MacBook-Air:git_test ga$ git init
Initialized empty Git repository in /Users/ga/test/git_test/.git/
GAs-MacBook-Air:git_test ga$ ls -a
. .. .git
GAs-MacBook-Air:git_test ga$ git status
On branch master
No commits yet
nothing to commit (create/copy files and use "git add" to track)
GAs-MacBook-Air:git_test ga$ touch post.txt
GAs-MacBook-Air:git_test ga$ ls
post.txt
GAs-MacBook-Air:git_test ga$ git status
On branch master
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
post.txt
nothing added to commit but untracked files present (use "git add" to track)
GAs-MacBook-Air:git_test ga$ git add .
GAs-MacBook-Air:git_test ga$ git commit -m "initial commit"
[master (root-commit) b3be940] initial commit
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 post.txt
GAs-MacBook-Air:git_test ga$ git log
commit b3be940b13233963102d62fb97ec0c13e8b687aa (HEAD -> master)
Author: Hammad Malik <[email protected]>
Date: Mon Nov 13 16:18:52 2017 -0500
initial commit
GAs-MacBook-Air:git_test ga$ git remote add origin [email protected]:hm-dev-git/git_test.git
GAs-MacBook-Air:git_test ga$ git push -u origin master
The authenticity of host 'github.com (192.30.253.112)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.253.112' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
GAs-MacBook-Air:git_test ga$ git push -u origin master
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
GAs-MacBook-Air:git_test ga$ git remote add origin [email protected]:hm-dev-git/git_test.git
fatal: remote origin already exists.
GAs-MacBook-Air:git_test ga$ git push -u origin master
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
GAs-MacBook-Air:git_test ga$ git remote -v
origin [email protected]:hm-dev-git/git_test.git (fetch)
origin [email protected]:hm-dev-git/git_test.git (push)
GAs-MacBook-Air:git_test ga$ git remote add origin https://github.com/hm-dev-git/git_test.git
fatal: remote origin already exists.
GAs-MacBook-Air:git_test ga$ git push -u origin master
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
GAs-MacBook-Air:git_test ga$ git remote rm origin
GAs-MacBook-Air:git_test ga$ git remote -v
GAs-MacBook-Air:git_test ga$ git remote add origin https://github.com/hm-dev-git/git_test.git
GAs-MacBook-Air:git_test ga$ git push -u origin master
Username for 'https://github.com': hm-dev-git
Password for 'https://[email protected]':
Counting objects: 3, done.
Writing objects: 100% (3/3), 214 bytes | 214.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://github.com/hm-dev-git/git_test.git
* [new branch] master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.
GAs-MacBook-Air:git_test ga$ git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
GAs-MacBook-Air:git_test ga$ cd ..
GAs-MacBook-Air:test ga$ git clone https://github.com/hm-dev-git/git_test-1.git shelley
Cloning into 'shelley'...
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 3 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
GAs-MacBook-Air:test ga$ ls
git_test shelley
GAs-MacBook-Air:test ga$ cd shelley/
GAs-MacBook-Air:shelley ga$ ls
post.txt
GAs-MacBook-Air:shelley ga$ git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
GAs-MacBook-Air:shelley ga$ touch hello.txt
GAs-MacBook-Air:shelley ga$ echo "Hey" > hello.txt
GAs-MacBook-Air:shelley ga$ cat hello.txt
Hey
GAs-MacBook-Air:shelley ga$ echo " there" > hello.txt
GAs-MacBook-Air:shelley ga$ cat hello.txt
there
GAs-MacBook-Air:shelley ga$ echo "Hey" > hello.txt
GAs-MacBook-Air:shelley ga$ cat hello.txt
Hey
GAs-MacBook-Air:shelley ga$ git add .
GAs-MacBook-Air:shelley ga$ git status
On branch master
Your branch is up to date with 'origin/master'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: hello.txt
GAs-MacBook-Air:shelley ga$ git commit -m "add hello.txt file"
[master c3e3dbf] add hello.txt file
1 file changed, 1 insertion(+)
create mode 100644 hello.txt
GAs-MacBook-Air:shelley ga$ git push
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 283 bytes | 283.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://github.com/hm-dev-git/git_test-1.git
8bec38b..c3e3dbf master -> master
GAs-MacBook-Air:shelley ga$ cd ..
GAs-MacBook-Air:test ga$ ls
git_test shelley
GAs-MacBook-Air:test ga$ cd git_test/
GAs-MacBook-Air:git_test ga$ git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
GAs-MacBook-Air:git_test ga$ ls
post.txt
GAs-MacBook-Air:git_test ga$ git pull origin master
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 4 (delta 0), reused 4 (delta 0), pack-reused 0
Unpacking objects: 100% (4/4), done.
From https://github.com/hm-dev-git/git_test
* branch master -> FETCH_HEAD
b3be940..49352b6 master -> origin/master
Updating b3be940..49352b6
Fast-forward
hello.txt | 1 +
1 file changed, 1 insertion(+)
create mode 100644 hello.txt
GAs-MacBook-Air:git_test ga$ ls
hello.txt post.txt
GAs-MacBook-Air:git_test ga$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment