Stop relying on GUI; CLI **ROCKS**
Switch branches/tags
Nothing to show
Clone or download
Latest commit cd6b4e8 Nov 22, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Xerox_Star_8010_workstations.jpg YOU DONT NEED GUI Sep 17, 2016
cli_tips.jpg add quick tips Nov 14, 2018
readme.md Update readme.md Nov 22, 2018

readme.md

You Don't Need GUI

It's for noobs :)

Graphical user interfaces are super friendly to computer users. They were introduced in reaction to the perceived steep learning curve of command-line interfaces (CLIs).

Xerox Star 8010 workstations

However, they often require more resources, are less powerful and hard to automate via scripting.

As a computer expert, we want to be more efficient and do our jobs better. We know that command words may not be easily discoverable or mnemonic, so we try to list some common tasks that you might be tempted to do in GUI.

Quick links

  1. copy a file
  2. duplicate a file
  3. copy a folder
  4. duplicate a folder
  5. move a file
  6. rename a file
  7. move a folder
  8. rename a folder
  9. merge folders
  10. create a new file
  11. create a new folder
  12. show file/folder size
  13. open a file with the default program
  14. zip a folder
  15. unzip a folder
  16. remove a file
  17. remove a folder
  18. list folder contents
  19. tree view a folder and its subfolders
  20. find a stale file
  21. show a calendar
  22. find a future date
  23. use a calculator
  24. force quit a program
  25. check server response
  26. view content of a file
  27. search for a text
  28. view an image
  29. Quick tips
  30. Hotkeys

copy a file

STOP DRAG AND DROPING A FILE, OR CMD/CTRL + C, CMD/CTRL + V A FILE πŸ‘Ž

Copy readme.txt to the documents folder

cp readme.txt documents/

duplicate a file

STOP RIGHT CLICKING AND DUPLICATE A FILE πŸ‘Ž

cp readme.txt readme.bak.txt

copy a folder

STOP DRAG AND DROPING A FOLDER, OR CMD/CTRL + C, CMD/CTRL + V A FOLDER πŸ‘Ž

Copy myMusic folder to the myMedia folder

cp -a myMusic myMedia/
# or
cp -a myMusic/ myMedia/myMusic/

duplicate a folder

STOP RIGHT CLICKING AND DUPLICATE A FOLDER πŸ‘Ž

cp -a myMusic/ myMedia/
# or if `myMedia` folder doesn't exist
cp -a myMusic myMedia/

move a file

STOP DRAG AND DROPING A FILE, OR CMD/CTRL + X, CMD/CTRL + V A FILE πŸ‘Ž

mv readme.txt documents/

Always use a trailing slash when moving files, for this reason.

rename a file

STOP RIGHT CLICKING AND RENAME A FILE πŸ‘Ž

mv readme.txt README.md

move a folder

STOP DRAG AND DROPING A FOLDER, OR CMD/CTRL + X, CMD/CTRL + V A FOLDER πŸ‘Ž

mv myMedia myMusic/
# or
mv myMedia/ myMusic/myMedia

rename a folder

STOP RIGHT CLICKING AND RENAME A FOLDER πŸ‘Ž

mv myMedia/ myMusic/

merge folders

STOP DRAG AND DROPING TO MERGE FOLDERS πŸ‘Ž

rsync -a /images/ /images2/

create a new file

STOP RIGHT CLICKING AND CREATE A NEW FILE πŸ‘Ž

touch 'new file'
# or
> 'new file'

create a new folder

STOP RIGHT CLICKING AND CREATE A NEW FOLDER πŸ‘Ž

mkdir 'untitled folder'
# or
mkdir -p 'path/may/not/exist/untitled folder'

show file/folder size

STOP RIGHT CLICKING AND SHOW FILE/FOLDER INFO πŸ‘Ž

stat -x readme.md
# or
du -sh readme.md

open a file with the default program

STOP DOUBLE CLICKING ON A FILE πŸ‘Ž

xdg-open file   # on Linux
open file       # on MacOS

zip a folder

STOP RIGHT CLICKING AND COMPRESS FOLDER πŸ‘Ž

zip -r archive_name.zip folder_to_compress

unzip a folder

STOP RIGHT CLICKING AND UNCOMPRESS FOLDER πŸ‘Ž

unzip archive_name.zip

remove a file

STOP RIGHT CLICKING AND DELETE A FILE PERMANENTLY πŸ‘Ž

rm my_useless_file

IMPORTANT: The rm command deletes my_useless_file permanently, which is equivalent to move my_useless_file to Recycle Bin and hit Empty Recycle Bin.

remove a folder

STOP RIGHT CLICKING AND DELETE A FOLDER PERMANENTLY πŸ‘Ž

rm -r my_useless_folder

list folder contents

STOP OPENING YOUR FINDER OR FILE EXPLORER πŸ‘Ž

ls -la my_folder

tree view a folder and its subfolders

STOP OPENING YOUR FINDER OR FILE EXPLORER πŸ‘Ž

tree                                                       # on Linux
find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'     # on MacOS

find a stale file

STOP USING YOUR FILE EXPLORER TO FIND A FILE πŸ‘Ž

Find all files modified more than 5 days ago

findΒ my_folder -mtime +5

show a calendar

STOP LOOKING UP WHAT THIS MONTH LOOKS LIKE BY CALENDAR WIDGETS πŸ‘Ž

Display a text calendar

cal

Display selected month and year calendar

cal 11 2018

find a future date

STOP USING WEBAPPS TO CALCULATE FUTURE DATES πŸ‘Ž

What is todays date?

date +%m/%d/%Y

What about a week from now?

date -d "+7 days"                                          # on Linux
date -j -v+7d                                              # on MacOS

use a calculator

STOP USING CALCULATOR WIDGET πŸ‘Ž

Want to use a calculator?

bc

force quit a program

STOP FORCE QUITTING A PROGRAM USING CTRL + ALT + DELETE πŸ‘Ž

killall program_name

check server response

STOP OPENING A BROWSER πŸ‘Ž

ping umair.surge.sh

view content of a file

STOP DOUBLE CLICKING A FILE πŸ‘Ž

cat apps/settings.py

search for a text

STOP CMD/CTRL + F IN A FOLDER πŸ‘Ž

grep -ir "Query" file.txt

view an image

STOP USING PREVIEW πŸ‘Ž

imgcat image.png

Quick tips

CLI tips

Hotkeys

Ctrl + A  Go to the beginning of the line you are currently typing on
Ctrl + E  Go to the end of the line you are currently typing on
Ctrl + L  Clears the Screen, similar to the clear command
Ctrl + U  Clears the line before the cursor position. If you are at the end of the line, clears the entire line.
Ctrl + H  Same as backspace
Ctrl + R  Let’s you search through previously used commands
Ctrl + C  Kill whatever you are running
Ctrl + D  Exit the current shell
Ctrl + Z  Puts whatever you are running into a suspended background process. fg restores it.
Ctrl + W  Delete the word before the cursor
Ctrl + K  Clear the line after the cursor
Ctrl + T  Swap the last two characters before the cursor
Esc + T   Swap the last two words before the cursor
Alt + F   Move cursor forward one word on the current line
Alt + B   Move cursor backward one word on the current line
Tab       Auto-complete files and folder names

Remember, you can always google or man the commands you are not familiar with.