This commit is contained in:
Steve Mao
2017-06-07 14:48:44 +10:00
committed by GitHub
parent aa1d675d2b
commit def98655f6

View File

@@ -47,7 +47,7 @@ As a computer expert, we want to be more efficient and do our jobs better. We kn
Copy `readme.txt` to the `documents` folder Copy `readme.txt` to the `documents` folder
``` ```shell
cp readme.txt documents/ cp readme.txt documents/
``` ```
@@ -55,7 +55,7 @@ cp readme.txt documents/
**STOP RIGHT CLICK AND DUPLICATE A FILE** **STOP RIGHT CLICK AND DUPLICATE A FILE**
``` ```shell
cp readme.txt readme.bak.txt cp readme.txt readme.bak.txt
``` ```
@@ -65,7 +65,7 @@ cp readme.txt readme.bak.txt
Copy `myMusic` folder to the `myMedia` folder Copy `myMusic` folder to the `myMedia` folder
``` ```shell
cp -a myMusic myMedia/ cp -a myMusic myMedia/
# or # or
cp -a myMusic/ myMedia/myMusic/ cp -a myMusic/ myMedia/myMusic/
@@ -75,7 +75,7 @@ cp -a myMusic/ myMedia/myMusic/
**STOP RIGHT CLICK AND DUPLICATE A FOLDER** **STOP RIGHT CLICK AND DUPLICATE A FOLDER**
``` ```shell
cp -a myMusic/ myMedia/ cp -a myMusic/ myMedia/
# or if `myMedia` folder doesn't exist # or if `myMedia` folder doesn't exist
cp -a myMusic myMedia/ cp -a myMusic myMedia/
@@ -85,7 +85,7 @@ cp -a myMusic myMedia/
**STOP DRAG AND DROP A FILE, OR CTRL + X, CTRL + V A FILE** **STOP DRAG AND DROP A FILE, OR CTRL + X, CTRL + V A FILE**
``` ```shell
mv readme.txt documents/ mv readme.txt documents/
``` ```
@@ -95,7 +95,7 @@ mv readme.txt documents/
**STOP RIGHT CLICK AND RENAME A FILE** **STOP RIGHT CLICK AND RENAME A FILE**
``` ```shell
mv readme.txt README.md mv readme.txt README.md
``` ```
@@ -103,7 +103,7 @@ mv readme.txt README.md
**STOP DRAG AND DROP A FOLDER, OR CTRL + X, CTRL + V A FOLDER** **STOP DRAG AND DROP A FOLDER, OR CTRL + X, CTRL + V A FOLDER**
``` ```shell
mv myMedia myMusic/ mv myMedia myMusic/
# or # or
mv myMedia/ myMusic/myMedia mv myMedia/ myMusic/myMedia
@@ -113,7 +113,7 @@ mv myMedia/ myMusic/myMedia
**STOP RIGHT CLICK AND RENAME A FOLDER** **STOP RIGHT CLICK AND RENAME A FOLDER**
``` ```shell
mv myMedia/ myMusic/ mv myMedia/ myMusic/
``` ```
@@ -121,7 +121,7 @@ mv myMedia/ myMusic/
**STOP DRAG AND DROP TO MERGE FOLDERS** **STOP DRAG AND DROP TO MERGE FOLDERS**
``` ```shell
rsync -a /images/ /images2/ rsync -a /images/ /images2/
``` ```
@@ -129,11 +129,9 @@ rsync -a /images/ /images2/
**STOP RIGHT CLICK AND CREATE A NEW FILE** **STOP RIGHT CLICK AND CREATE A NEW FILE**
``` ```shell
touch 'new file' touch 'new file'
``` # or
or
```
> 'new file' > 'new file'
``` ```
@@ -141,13 +139,9 @@ or
**STOP RIGHT CLICK AND CREATE A NEW FOLDER** **STOP RIGHT CLICK AND CREATE A NEW FOLDER**
``` ```shell
mkdir 'untitled folder' mkdir 'untitled folder'
``` # or
or
```
mkdir -p 'path/may/not/exist/untitled folder' mkdir -p 'path/may/not/exist/untitled folder'
``` ```
@@ -155,13 +149,9 @@ mkdir -p 'path/may/not/exist/untitled folder'
**STOP RIGHT CLICK AND SHOW FILE/FOLDER INFO** **STOP RIGHT CLICK AND SHOW FILE/FOLDER INFO**
``` ```shell
stat -x readme.md stat -x readme.md
``` # or
or
```
du -sh readme.md du -sh readme.md
``` ```
@@ -169,16 +159,16 @@ du -sh readme.md
**STOP DOUBLE CLICKING A FILE** **STOP DOUBLE CLICKING A FILE**
``` ```shell
open file # on macOS
xdg-open file # on Linux xdg-open file # on Linux
open file # on MacOS
``` ```
## <a id="zipfolder"></a>zip a folder ## <a id="zipfolder"></a>zip a folder
**STOP RIGHT CLICK AND COMPRESS FOLDER** **STOP RIGHT CLICK AND COMPRESS FOLDER**
``` ```shell
zip -r archive_name.zip folder_to_compress zip -r archive_name.zip folder_to_compress
``` ```
@@ -186,7 +176,7 @@ zip -r archive_name.zip folder_to_compress
**STOP RIGHT CLICK AND UNCOMPRESS FOLDER** **STOP RIGHT CLICK AND UNCOMPRESS FOLDER**
``` ```shell
unzip archive_name.zip unzip archive_name.zip
``` ```
@@ -194,16 +184,17 @@ unzip archive_name.zip
**STOP RIGHT CLICK AND DELETE A FILE PERMANENTLY** **STOP RIGHT CLICK AND DELETE A FILE PERMANENTLY**
``` ```shell
rm my_useless_file 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. 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.
## <a id="removefolder"></a>remove a folder ## <a id="removefolder"></a>remove a folder
**STOP RIGHT CLICK AND DELETE A FOLDER PERMANENTLY** **STOP RIGHT CLICK AND DELETE A FOLDER PERMANENTLY**
``` ```shell
rm -r my_useless_folder rm -r my_useless_folder
``` ```
@@ -211,24 +202,26 @@ rm -r my_useless_folder
**STOP OPENING YOUR FINDER OR FILE EXPLORER** **STOP OPENING YOUR FINDER OR FILE EXPLORER**
``` ```shell
ls -la my_folder ls -la my_folder
``` ```
## <a id="treeview"></a>tree view a folder and its subfolders ## <a id="treeview"></a>tree view a folder and its subfolders
**STOP OPENING YOUR FINDER OR FILE EXPLORER** **STOP OPENING YOUR FINDER OR FILE EXPLORER**
``` ```shell
tree # on Linux tree # on Linux
find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g' # on macOS find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g' # on MacOS
``` ```
## <a id="findfile"></a>find a stale file ## <a id="findfile"></a>find a stale file
**STOP USING YOUR FILE EXPLORER TO FIND A FILE** **STOP USING YOUR FILE EXPLORER TO FIND A FILE**
Find all files modified more than 5 days ago Find all files modified more than 5 days ago
```bash ```shell
find my_folder -mtime +5 find my_folder -mtime +5
``` ```
@@ -238,7 +231,7 @@ find my_folder -mtime +5
Display a text calendar Display a text calendar
``` ```shell
cal cal
``` ```
@@ -248,15 +241,15 @@ cal
What is todays date? What is todays date?
``` ```shell
date +%m/%d/%Y date +%m/%d/%Y
``` ```
What about a week from now? What about a week from now?
```bash ```shell
date -d "+7 days" # On Linux date -d "+7 days" # on Linux
date -j -v+7d # On MacOS date -j -v+7d # on MacOS
``` ```
## <a id="calculator"></a>use a calculator ## <a id="calculator"></a>use a calculator
@@ -265,7 +258,7 @@ date -j -v+7d # On MacOS
Want to use a calculator? Want to use a calculator?
``` ```shell
bc bc
``` ```
@@ -273,7 +266,7 @@ bc
**STOP FORCE QUITE A PROGRAM USING GUI** **STOP FORCE QUITE A PROGRAM USING GUI**
``` ```shell
killall program_name killall program_name
``` ```