<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
Disc Space
du -ha --max-depth=1
-h = human readable
-a = all (includes files as well as dirs)
# EG:
$ du -ha --max-depth=1
1.4G ./uploads
8.0K ./.DS_Store
1.2M ./themes
5.2G ./debug.log
8.0K ./cache
4.0K ./index.php
4.0K ./upgrade
61M ./plugins6.6G
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.
Leave a Reply
Comments
No comments on this article.
comments powered by Disqus