mirror of
https://github.com/you-dont-need/You-Dont-Need-GUI.git
synced 2025-08-01 11:00:21 +02:00
Update readme.md
Add "Go to table of contents"
This commit is contained in:
94
readme.md
94
readme.md
@@ -75,6 +75,8 @@ Copy `readme.txt` to the `documents` directory
|
|||||||
```shell
|
```shell
|
||||||
$ cp readme.txt documents/
|
$ cp readme.txt documents/
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## duplicate a file
|
## duplicate a file
|
||||||
|
|
||||||
@@ -88,6 +90,8 @@ More advanced:
|
|||||||
$ cp readme{,.bak}.txt
|
$ cp readme{,.bak}.txt
|
||||||
# Note: learn how the {} works with touch foo{1,2,3}.txt and see what happens.
|
# Note: learn how the {} works with touch foo{1,2,3}.txt and see what happens.
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## copy a directory
|
## copy a directory
|
||||||
|
|
||||||
@@ -100,6 +104,8 @@ $ cp -a myMusic myMedia/
|
|||||||
# or
|
# or
|
||||||
$ cp -a myMusic/ myMedia/myMusic/
|
$ cp -a myMusic/ myMedia/myMusic/
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## duplicate a directory
|
## duplicate a directory
|
||||||
|
|
||||||
@@ -110,6 +116,8 @@ $ 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/
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## move a file
|
## move a file
|
||||||
|
|
||||||
@@ -121,6 +129,8 @@ $ mv readme.txt documents/
|
|||||||
|
|
||||||
**Always** use a trailing slash when moving files, [for this reason](http://unix.stackexchange.com/a/50533).
|
**Always** use a trailing slash when moving files, [for this reason](http://unix.stackexchange.com/a/50533).
|
||||||
|
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
## rename a file
|
## rename a file
|
||||||
|
|
||||||
**STOP RIGHT CLICKING AND RENAME A FILE** :-1:
|
**STOP RIGHT CLICKING AND RENAME A FILE** :-1:
|
||||||
@@ -128,6 +138,8 @@ $ mv readme.txt documents/
|
|||||||
```shell
|
```shell
|
||||||
$ mv readme.txt README.md
|
$ mv readme.txt README.md
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## move a directory
|
## move a directory
|
||||||
|
|
||||||
@@ -138,6 +150,8 @@ $ mv myMedia myMusic/
|
|||||||
# or
|
# or
|
||||||
$ mv myMedia/ myMusic/myMedia
|
$ mv myMedia/ myMusic/myMedia
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## rename a directory
|
## rename a directory
|
||||||
|
|
||||||
@@ -146,6 +160,8 @@ $ mv myMedia/ myMusic/myMedia
|
|||||||
```shell
|
```shell
|
||||||
$ mv myMedia/ myMusic/
|
$ mv myMedia/ myMusic/
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## merge directories
|
## merge directories
|
||||||
|
|
||||||
@@ -154,6 +170,8 @@ $ mv myMedia/ myMusic/
|
|||||||
```shell
|
```shell
|
||||||
$ rsync -a /images/ /images2/ # note: may over-write files with the same name, so be careful!
|
$ rsync -a /images/ /images2/ # note: may over-write files with the same name, so be careful!
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## create a new file
|
## create a new file
|
||||||
|
|
||||||
@@ -164,6 +182,8 @@ $ touch 'new file' # updates the file's access and modification timestamp if
|
|||||||
# or
|
# or
|
||||||
$ > 'new file' # note: erases the content if it already exists
|
$ > 'new file' # note: erases the content if it already exists
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## create a new directory
|
## create a new directory
|
||||||
|
|
||||||
@@ -174,6 +194,8 @@ $ mkdir 'untitled folder'
|
|||||||
# or
|
# or
|
||||||
$ mkdir -p 'path/may/not/exist/untitled folder'
|
$ mkdir -p 'path/may/not/exist/untitled folder'
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## show file/directory size
|
## show file/directory size
|
||||||
|
|
||||||
@@ -182,6 +204,8 @@ $ mkdir -p 'path/may/not/exist/untitled folder'
|
|||||||
```shell
|
```shell
|
||||||
$ du -sh node_modules/
|
$ du -sh node_modules/
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## show file/directory info
|
## show file/directory info
|
||||||
|
|
||||||
@@ -191,6 +215,8 @@ $ du -sh node_modules/
|
|||||||
$ stat -x readme.md # on macOS
|
$ stat -x readme.md # on macOS
|
||||||
$ stat readme.md # on Linux
|
$ stat readme.md # on Linux
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## open a file with the default program
|
## open a file with the default program
|
||||||
|
|
||||||
@@ -201,6 +227,8 @@ $ xdg-open file # on Linux
|
|||||||
$ open file # on MacOS
|
$ open file # on MacOS
|
||||||
$ start file # on Windows
|
$ start file # on Windows
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## open a file in any application
|
## open a file in any application
|
||||||
|
|
||||||
@@ -209,6 +237,8 @@ $ start file # on Windows
|
|||||||
```shell
|
```shell
|
||||||
$ open -a appName file
|
$ open -a appName file
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## zip a directory
|
## zip a directory
|
||||||
|
|
||||||
@@ -217,6 +247,8 @@ $ open -a appName file
|
|||||||
```shell
|
```shell
|
||||||
$ zip -r archive_name.zip folder_to_compress
|
$ zip -r archive_name.zip folder_to_compress
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## unzip a directory
|
## unzip a directory
|
||||||
|
|
||||||
@@ -225,6 +257,8 @@ $ zip -r archive_name.zip folder_to_compress
|
|||||||
```shell
|
```shell
|
||||||
$ unzip archive_name.zip
|
$ unzip archive_name.zip
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## decompress files of any format
|
## decompress files of any format
|
||||||
|
|
||||||
@@ -237,6 +271,8 @@ $ unar archive_name.rar
|
|||||||
$ unar archive_name.ISO
|
$ unar archive_name.ISO
|
||||||
$ unar archive_name.tar.gz
|
$ unar archive_name.tar.gz
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## peek files in a zip file
|
## peek files in a zip file
|
||||||
|
|
||||||
@@ -247,6 +283,8 @@ $ zipinfo archive_name.zip
|
|||||||
# or
|
# or
|
||||||
$ unzip -l archive_name.zip
|
$ unzip -l archive_name.zip
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## peek files in a compress file of any format
|
## peek files in a compress file of any format
|
||||||
|
|
||||||
@@ -259,6 +297,8 @@ $ lsar -l archive_name.ISO
|
|||||||
$ lsar -l archive_name.rar
|
$ lsar -l archive_name.rar
|
||||||
$ lsar -l archive_name.tar.gz
|
$ lsar -l archive_name.tar.gz
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## remove a file
|
## remove a file
|
||||||
|
|
||||||
@@ -270,6 +310,8 @@ $ 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.
|
||||||
|
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
## remove a directory
|
## remove a directory
|
||||||
|
|
||||||
**STOP RIGHT CLICKING AND DELETE A DIRECTORY PERMANENTLY** :-1:
|
**STOP RIGHT CLICKING AND DELETE A DIRECTORY PERMANENTLY** :-1:
|
||||||
@@ -277,6 +319,8 @@ $ rm my_useless_file
|
|||||||
```shell
|
```shell
|
||||||
$ rm -r my_useless_folder
|
$ rm -r my_useless_folder
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## remove all files of certain criteria
|
## remove all files of certain criteria
|
||||||
|
|
||||||
@@ -286,6 +330,8 @@ find . -name "*.bak" -type f -delete
|
|||||||
|
|
||||||
**IMPORTANT**: run `find . -name "*.bak" -type f` first to see exactly which files you will remove.
|
**IMPORTANT**: run `find . -name "*.bak" -type f` first to see exactly which files you will remove.
|
||||||
|
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
## list directory contents
|
## list directory contents
|
||||||
|
|
||||||
**STOP OPENING YOUR FINDER OR FILE EXPLORER** :-1:
|
**STOP OPENING YOUR FINDER OR FILE EXPLORER** :-1:
|
||||||
@@ -295,6 +341,8 @@ $ ls my_folder # Simple
|
|||||||
$ ls -la my_folder # -l: show in list format. -a: show all files, including hidden. -la combines those options.
|
$ ls -la my_folder # -l: show in list format. -a: show all files, including hidden. -la combines those options.
|
||||||
$ ls -alrth my_folder # -r: reverse output. -t: sort by time (modified). -h: output human-readable sizes.
|
$ ls -alrth my_folder # -r: reverse output. -t: sort by time (modified). -h: output human-readable sizes.
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## tree view a directory and its subdirectories
|
## tree view a directory and its subdirectories
|
||||||
|
|
||||||
@@ -306,6 +354,8 @@ $ find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g' # on MacOS
|
|||||||
# Note: install homebrew (https://brew.sh) to be able to use (some) Linux utilities such as tree.
|
# Note: install homebrew (https://brew.sh) to be able to use (some) Linux utilities such as tree.
|
||||||
# brew install tree
|
# brew install tree
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## find a stale file
|
## find a stale file
|
||||||
|
|
||||||
@@ -316,6 +366,8 @@ Find all files modified more than 5 days ago
|
|||||||
```shell
|
```shell
|
||||||
$ find my_folder -mtime +5
|
$ find my_folder -mtime +5
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## show a calendar
|
## show a calendar
|
||||||
|
|
||||||
@@ -331,6 +383,8 @@ Display selected month and year calendar
|
|||||||
```shell
|
```shell
|
||||||
$ cal 11 2018
|
$ cal 11 2018
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## find a future date
|
## find a future date
|
||||||
|
|
||||||
@@ -348,6 +402,8 @@ What about a week from now?
|
|||||||
$ date -d "+7 days" # on Linux
|
$ date -d "+7 days" # on Linux
|
||||||
$ date -j -v+7d # on MacOS
|
$ date -j -v+7d # on MacOS
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## use a calculator
|
## use a calculator
|
||||||
|
|
||||||
@@ -356,6 +412,8 @@ $ date -j -v+7d # on MacOS
|
|||||||
```shell
|
```shell
|
||||||
$ bc -l
|
$ bc -l
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## force quit a program
|
## force quit a program
|
||||||
|
|
||||||
@@ -364,6 +422,8 @@ $ bc -l
|
|||||||
```shell
|
```shell
|
||||||
$ killall -9 program_name
|
$ killall -9 program_name
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## check server response
|
## check server response
|
||||||
|
|
||||||
@@ -373,6 +433,8 @@ $ killall -9 program_name
|
|||||||
curl -i umair.surge.sh
|
curl -i umair.surge.sh
|
||||||
# curl's -i (--include) option includes HTTP response headers in its output.
|
# curl's -i (--include) option includes HTTP response headers in its output.
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## view content of a file
|
## view content of a file
|
||||||
|
|
||||||
@@ -383,6 +445,8 @@ $ cat apps/settings.py
|
|||||||
# if the file is too big to fit on one page, you can use a 'pager' (less) which shows you one page at a time.
|
# if the file is too big to fit on one page, you can use a 'pager' (less) which shows you one page at a time.
|
||||||
$ less apps/settings.py
|
$ less apps/settings.py
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## search for a text in a file
|
## search for a text in a file
|
||||||
|
|
||||||
@@ -391,6 +455,8 @@ $ less apps/settings.py
|
|||||||
```shell
|
```shell
|
||||||
$ grep -i "Query" file.txt
|
$ grep -i "Query" file.txt
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -402,6 +468,8 @@ $ grep -i "Query" file.txt
|
|||||||
$ ripgrep -i "Query"
|
$ ripgrep -i "Query"
|
||||||
# brew install ripgrep
|
# brew install ripgrep
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## view an image
|
## view an image
|
||||||
|
|
||||||
@@ -411,6 +479,8 @@ $ ripgrep -i "Query"
|
|||||||
$ imgcat image.png
|
$ imgcat image.png
|
||||||
# Note: requires iTerm2 terminal.
|
# Note: requires iTerm2 terminal.
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## show disk size
|
## show disk size
|
||||||
|
|
||||||
@@ -419,6 +489,8 @@ $ imgcat image.png
|
|||||||
```shell
|
```shell
|
||||||
$ df -h
|
$ df -h
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## check performance of your computer
|
## check performance of your computer
|
||||||
|
|
||||||
@@ -427,6 +499,8 @@ $ df -h
|
|||||||
```shell
|
```shell
|
||||||
$ top
|
$ top
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## know whether your computer is under load, and whether it's due to memory or CPU
|
## know whether your computer is under load, and whether it's due to memory or CPU
|
||||||
|
|
||||||
@@ -434,6 +508,8 @@ $ top
|
|||||||
$ glances
|
$ glances
|
||||||
# brew install glances
|
# brew install glances
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## poweroff or reboot your computer
|
## poweroff or reboot your computer
|
||||||
|
|
||||||
@@ -445,18 +521,24 @@ sudo shutdown -h now
|
|||||||
# reboot
|
# reboot
|
||||||
sudo shutdown -r now
|
sudo shutdown -r now
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## locate USB drives
|
## locate USB drives
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ df
|
$ df
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## unmount USB drives
|
## unmount USB drives
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ sudo umount /dev/sdb1
|
$ sudo umount /dev/sdb1
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## format USB drives
|
## format USB drives
|
||||||
|
|
||||||
@@ -468,12 +550,16 @@ $ sudo mkfs.ntfs /dev/sdb1
|
|||||||
# exFAT
|
# exFAT
|
||||||
$ sudo mkfs.exfat /dev/sdb1
|
$ sudo mkfs.exfat /dev/sdb1
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## check USB format
|
## check USB format
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
sudo fsck /dev/sdb1
|
sudo fsck /dev/sdb1
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## run command on all files of a directory
|
## run command on all files of a directory
|
||||||
|
|
||||||
@@ -482,11 +568,15 @@ sudo fsck /dev/sdb1
|
|||||||
```shell
|
```shell
|
||||||
for FILE in *; do echo $FILE; done
|
for FILE in *; do echo $FILE; done
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## Quick tips
|
## Quick tips
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
## Hotkeys
|
## Hotkeys
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -513,7 +603,11 @@ Esc + B Same as Alt + B
|
|||||||
Alt + . Paste the last word of the most recently command
|
Alt + . Paste the last word of the most recently command
|
||||||
Tab Auto-complete files and directory names
|
Tab Auto-complete files and directory names
|
||||||
```
|
```
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
|
||||||
|
|
||||||
## I can't remember these cryptic commands
|
## I can't remember these cryptic commands
|
||||||
|
|
||||||
You can always google or `man` the commands you are not familiar with. Or, checkout [tldr](https://github.com/tldr-pages/tldr), a collection of simplified and community-driven man pages.
|
You can always google or `man` the commands you are not familiar with. Or, checkout [tldr](https://github.com/tldr-pages/tldr), a collection of simplified and community-driven man pages.
|
||||||
|
|
||||||
|
[Go to table of contents 🔼](#quick-links)
|
||||||
|
Reference in New Issue
Block a user