Getting Started with Terminal
<3 Your Terminal
Is terminal in your Doc? do you use it? If not you are missing out as a web professional. Learning a few commands, or at least being aware of what to look up, makes you more productive and confident on your own (Linux or OSX) machine and when working on a server.
Navigating
# get username
❯ whoami
obiwan
#find out where you are
❯ pwd
/Users/obiwan/test
# what is in this dir?
❯ ls
# bit more detail about permissions, filesizes etc...
❯ ls -l
drwxr-xr-x 3 obiwan staff 102 27 Nov 15:51 andy
-rw-r--r-- 1 obiwan staff 812 27 Nov 15:56 andy.zip
# whats in here?
❯ tree
.
├── obiwan
│ └── bob
│ ├── somefile.txt
│ ├── test.txt
│ └── text.txt
└── text.txt
# move about
❯ cd SomeFolder
#up one level
❯ cd ..
#two
❯ cd ../..
#put it together...
❯ cd ../../images/somthing
Working with Files and Archives
# make a Folder
❯ mkdir SomeFolder
# make a file
❯ touch somefile.txt
# put text into a file
❯ echo "some output" > somefile.txt
# read a text file contents
❯ cat somefile.txt
# copy a file or dir
❯ cp SomeFile destinationDir
# move a file or dir
❯ mv SomeFile destinationDir
# delete a file
❯ rm SomeFile
# Delete a folder and everything in it
❯ rm -r SomeFolder
# archive the obiwan folder
❯ zip -r obiwan.zip obiwan
# and unzip it
❯ unzip obiwan.zip
That’s it for now. Next up, Git, Searching, SSH & SFTP. Scary? Not really and once you have the hang of it you won’t look back.