You-Dont-Need-GUI/readme.md

275 lines
5.3 KiB
Markdown
Raw Normal View History

2016-09-17 18:54:40 +10:00
# You Don't Need GUI
<details>
It's for noobs :)
</details>
2017-04-08 10:59:32 +10:00
<br />
2016-09-17 18:54:40 +10:00
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](./Xerox_Star_8010_workstations.jpg)
2016-09-18 17:39:18 +10:00
However, they often require more resources, are less powerful and hard to automate via scripting.
2016-09-17 18:54:40 +10:00
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 tempt to do in GUI.
2016-09-18 10:42:02 +10:00
## Quick links
2017-11-17 17:35:58 +11:00
1. [copy a file](#copy-a-file)
1. [duplicate a file](#duplicate-a-file)
1. [copy a folder](#copy-a-folder)
1. [duplicate a folder](#duplicate-a-folder)
1. [move a file](#move-a-file)
1. [rename a file](#rename-a-file)
1. [move a folder](#move-a-folder)
1. [rename a folder](#rename-a-folder)
1. [merge folders](#merge-folders)
1. [create a new file](#create-a-new-file)
1. [create a new folder](#create-a-new-folder)
2017-11-17 17:36:33 +11:00
1. [show file/folder size](#show-filefolder-size)
2017-11-17 17:35:58 +11:00
1. [open a file with the default program](#open-a-file-with-the-default-program)
1. [zip a folder](#zip-a-folder)
1. [unzip a folder](#unzip-a-folder)
1. [remove a file](#remove-a-file)
1. [remove a folder](#remove-a-folder)
1. [list folder contents](#list-folder-contents)
1. [tree view a folder and its subfolders](#tree-view-a-folder-and-its-subfolders)
1. [find a stale file](#find-a-stale-file)
1. [show a calendar](#show-a-calendar)
1. [find a future date](#find-a-future-date)
1. [use a calculator](#use-a-calculator)
1. [kill a program](#kill-a-program)
## copy a file
2016-09-17 18:54:40 +10:00
2017-11-17 16:59:51 +11:00
**STOP DRAG AND DROP A FILE, OR CMD/CTRL + C, CMD/CTRL + V A FILE** :-1:
2016-09-17 18:54:40 +10:00
Copy `readme.txt` to the `documents` folder
2017-06-07 14:48:44 +10:00
```shell
cp readme.txt documents/
2016-09-17 18:54:40 +10:00
```
2017-11-17 17:35:58 +11:00
## duplicate a file
2016-09-17 20:22:03 +10:00
2017-11-17 16:59:51 +11:00
**STOP RIGHT CLICK AND DUPLICATE A FILE** :-1:
2016-09-17 20:22:03 +10:00
2017-06-07 14:48:44 +10:00
```shell
2016-09-17 20:22:03 +10:00
cp readme.txt readme.bak.txt
```
2017-11-17 17:35:58 +11:00
## copy a folder
2016-09-17 18:54:40 +10:00
2017-11-17 16:59:51 +11:00
**STOP DRAG AND DROP A FOLDER, OR CMD/CTRL + C, CMD/CTRL + V A FOLDER** :-1:
2016-09-17 18:54:40 +10:00
Copy `myMusic` folder to the `myMedia` folder
2016-09-17 18:54:40 +10:00
2017-06-07 14:48:44 +10:00
```shell
2017-01-11 15:52:28 +11:00
cp -a myMusic myMedia/
# or
cp -a myMusic/ myMedia/myMusic/
2016-09-17 18:54:40 +10:00
```
2017-11-17 17:35:58 +11:00
## duplicate a folder
2016-09-17 20:16:35 +10:00
2017-11-17 16:59:51 +11:00
**STOP RIGHT CLICK AND DUPLICATE A FOLDER** :-1:
2016-09-17 20:16:35 +10:00
2017-06-07 14:48:44 +10:00
```shell
cp -a myMusic/ myMedia/
2017-01-11 15:56:51 +11:00
# or if `myMedia` folder doesn't exist
cp -a myMusic myMedia/
2016-09-17 20:16:35 +10:00
```
2017-11-17 17:35:58 +11:00
## move a file
2016-09-17 18:54:40 +10:00
2017-11-17 16:59:51 +11:00
**STOP DRAG AND DROP A FILE, OR CTRL + X, CTRL + V A FILE** :-1:
2016-09-17 18:54:40 +10:00
2017-06-07 14:48:44 +10:00
```shell
mv readme.txt documents/
2016-09-17 18:54:40 +10:00
```
**Always** use a trailing slash when moving files, [for this reason](http://unix.stackexchange.com/a/50533).
2017-11-17 17:35:58 +11:00
## rename a file
2016-10-16 00:13:32 +02:00
2017-11-17 16:59:51 +11:00
**STOP RIGHT CLICK AND RENAME A FILE** :-1:
2016-10-16 00:13:32 +02:00
2017-06-07 14:48:44 +10:00
```shell
2016-10-16 00:13:32 +02:00
mv readme.txt README.md
```
2017-11-17 17:35:58 +11:00
## move a folder
2016-09-17 18:54:40 +10:00
2017-11-17 16:59:51 +11:00
**STOP DRAG AND DROP A FOLDER, OR CTRL + X, CTRL + V A FOLDER** :-1:
2016-09-17 18:54:40 +10:00
2017-06-07 14:48:44 +10:00
```shell
2017-01-11 15:52:28 +11:00
mv myMedia myMusic/
# or
mv myMedia/ myMusic/myMedia
```
2017-11-17 17:35:58 +11:00
## rename a folder
2017-11-17 16:59:51 +11:00
**STOP RIGHT CLICK AND RENAME A FOLDER** :-1:
2017-06-07 14:48:44 +10:00
```shell
mv myMedia/ myMusic/
2016-09-17 18:54:40 +10:00
```
2017-11-17 17:35:58 +11:00
## merge folders
2017-02-25 08:26:01 +11:00
2017-11-17 16:59:51 +11:00
**STOP DRAG AND DROP TO MERGE FOLDERS** :-1:
2017-02-25 08:26:01 +11:00
2017-06-07 14:48:44 +10:00
```shell
2017-02-25 08:26:01 +11:00
rsync -a /images/ /images2/
```
2017-11-17 17:35:58 +11:00
## create a new file
2016-09-17 18:54:40 +10:00
2017-11-17 16:59:51 +11:00
**STOP RIGHT CLICK AND CREATE A NEW FILE** :-1:
2016-09-17 18:54:40 +10:00
2017-06-07 14:48:44 +10:00
```shell
2016-09-17 18:54:40 +10:00
touch 'new file'
2017-06-07 14:48:44 +10:00
# or
> 'new file'
```
2016-09-17 18:54:40 +10:00
2017-11-17 17:35:58 +11:00
## create a new folder
2016-09-17 18:54:40 +10:00
2017-11-17 16:59:51 +11:00
**STOP RIGHT CLICK AND CREATE A NEW FOLDER** :-1:
2016-09-17 18:54:40 +10:00
2017-06-07 14:48:44 +10:00
```shell
2016-09-17 18:54:40 +10:00
mkdir 'untitled folder'
2017-06-07 14:48:44 +10:00
# or
2016-09-17 18:54:40 +10:00
mkdir -p 'path/may/not/exist/untitled folder'
```
2017-11-17 17:35:58 +11:00
## show file/folder size
2016-09-17 18:54:40 +10:00
2017-11-17 16:59:51 +11:00
**STOP RIGHT CLICK AND SHOW FILE/FOLDER INFO** :-1:
2016-09-17 18:54:40 +10:00
2017-06-07 14:48:44 +10:00
```shell
2016-09-17 18:54:40 +10:00
stat -x readme.md
2017-06-07 14:48:44 +10:00
# or
du -sh readme.md
```
2017-11-17 17:35:58 +11:00
## open a file with the default program
2016-09-17 18:54:40 +10:00
2017-11-17 16:59:51 +11:00
**STOP DOUBLE CLICKING A FILE** :-1:
2016-09-17 18:54:40 +10:00
2017-06-07 14:48:44 +10:00
```shell
2016-11-06 20:50:12 +01:00
xdg-open file # on Linux
2017-06-07 14:48:44 +10:00
open file # on MacOS
2016-09-17 18:54:40 +10:00
```
2017-11-17 17:35:58 +11:00
## zip a folder
2016-09-17 18:54:40 +10:00
2017-11-17 16:59:51 +11:00
**STOP RIGHT CLICK AND COMPRESS FOLDER** :-1:
2016-09-17 18:54:40 +10:00
2017-06-07 14:48:44 +10:00
```shell
2016-09-17 18:54:40 +10:00
zip -r archive_name.zip folder_to_compress
```
2017-11-17 17:35:58 +11:00
## unzip a folder
2016-09-17 18:54:40 +10:00
2017-11-17 16:59:51 +11:00
**STOP RIGHT CLICK AND UNCOMPRESS FOLDER** :-1:
2016-09-17 18:54:40 +10:00
2017-06-07 14:48:44 +10:00
```shell
2016-09-17 18:54:40 +10:00
unzip archive_name.zip
```
2017-11-17 17:35:58 +11:00
## remove a file
2016-09-17 18:54:40 +10:00
2017-11-17 16:59:51 +11:00
**STOP RIGHT CLICK AND DELETE A FILE PERMANENTLY** :-1:
2016-09-17 18:54:40 +10:00
2017-06-07 14:48:44 +10:00
```shell
2016-09-17 18:54:40 +10:00
rm my_useless_file
```
2017-06-07 14:48:44 +10:00
2016-11-15 11:46:09 +11:00
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.
2016-09-17 18:54:40 +10:00
2017-11-17 17:35:58 +11:00
## remove a folder
2016-09-17 18:54:40 +10:00
2017-11-17 16:59:51 +11:00
**STOP RIGHT CLICK AND DELETE A FOLDER PERMANENTLY** :-1:
2016-09-17 18:54:40 +10:00
2017-06-07 14:48:44 +10:00
```shell
2016-10-16 15:44:39 +02:00
rm -r my_useless_folder
2016-09-17 18:54:40 +10:00
```
2017-11-17 17:35:58 +11:00
## list folder contents
2016-09-17 18:54:40 +10:00
2017-11-17 16:59:51 +11:00
**STOP OPENING YOUR FINDER OR FILE EXPLORER** :-1:
2016-09-17 18:54:40 +10:00
2017-06-07 14:48:44 +10:00
```shell
2016-09-17 18:54:40 +10:00
ls -la my_folder
```
2017-06-07 14:48:44 +10:00
2017-11-17 17:35:58 +11:00
## tree view a folder and its subfolders
2016-09-17 18:54:40 +10:00
2017-11-17 16:59:51 +11:00
**STOP OPENING YOUR FINDER OR FILE EXPLORER** :-1:
2016-11-12 00:20:38 +00:00
2017-06-07 14:48:44 +10:00
```shell
2016-11-11 21:48:25 -06:00
tree # on Linux
2017-06-07 14:48:44 +10:00
find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g' # on MacOS
2016-11-12 00:20:38 +00:00
```
2017-06-07 14:48:44 +10:00
2017-11-17 17:35:58 +11:00
## find a stale file
2017-11-17 16:59:51 +11:00
**STOP USING YOUR FILE EXPLORER TO FIND A FILE** :-1:
Find all files modified more than 5 days ago
2017-06-07 14:48:44 +10:00
```shell
find my_folder -mtime +5
```
2017-11-17 17:35:58 +11:00
## show a calendar
2017-11-17 16:59:51 +11:00
**STOP LOOKING UP WHAT THIS MONTH LOOKS LIKE BY CALENDAR WIDGETS** :-1:
Display a text calendar
2017-06-07 14:48:44 +10:00
```shell
cal
```
2017-11-17 17:35:58 +11:00
## find a future date
2017-11-17 16:59:51 +11:00
**STOP USING WEBAPPS TO CALCULATE FUTURE DATES** :-1:
What is todays date?
2017-06-07 14:48:44 +10:00
```shell
date +%m/%d/%Y
```
What about a week from now?
2017-06-07 14:48:44 +10:00
```shell
date -d "+7 days" # on Linux
date -j -v+7d # on MacOS
```
2017-11-17 17:35:58 +11:00
## use a calculator
2016-11-27 21:51:42 +11:00
2017-11-17 16:59:51 +11:00
**STOP USING CALCULATOR WIDGET** :-1:
2016-11-27 21:51:42 +11:00
Want to use a calculator?
2017-06-07 14:48:44 +10:00
```shell
2016-11-27 21:51:42 +11:00
bc
```
2017-11-17 17:35:58 +11:00
## force quit a program
2017-02-24 15:58:28 +11:00
2017-11-17 16:59:51 +11:00
**STOP FORCE QUITE A PROGRAM USING GUI** :-1:
2017-02-24 15:58:28 +11:00
2017-06-07 14:48:44 +10:00
```shell
2017-02-24 15:58:28 +11:00
killall program_name
```
2017-04-26 09:33:46 +10:00
---
2016-09-18 18:16:37 +10:00
_Remember, you can always google or `man` the commands you are not familiar with._