You-Dont-Need-GUI

Stop relying on GUI; CLI **ROCKS**
授权协议 Readme
开发语言 JavaScript
所属分类 应用工具、 终端/远程登录
软件类型 开源软件
地区 不详
投 递 者 蔚承天
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

You Don't Need GUI

Join the community on Spectrum

中文版请看这里

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).

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 directory
  4. duplicate a directory
  5. move a file
  6. rename a file
  7. move a directory
  8. rename a directory
  9. merge directories
  10. create a new file
  11. create a new directory
  12. show file/directory size
  13. show file/directory info
  14. open a file with the default program
  15. open a file in any application
  16. zip a directory
  17. unzip a directory
  18. peek files in a zip file
  19. remove a file
  20. remove a directory
  21. list directory contents
  22. tree view a directory and its subdirectories
  23. find a stale file
  24. show a calendar
  25. find a future date
  26. use a calculator
  27. force quit a program
  28. check server response
  29. view content of a file
  30. search for a text in a file
  31. search in all files in current working directory, quickly (entire disk in less than 15 minutes)
  32. view an image
  33. show disk size
  34. check performance of your computer
  35. know whether your computer is under load, and whether it's due to memory or CPU
  36. poweroff or reboot your computer
  37. locate USB drives
  38. unmount USB drives
  39. format USB drives
  40. check USB format
  41. Quick tips
  42. Hotkeys
  43. I can't remember these cryptic commands

copy a file

STOP DRAG AND DROPPING A FILE, OR CMD/CTRL + C, CMD/CTRL + V A FILE ��

Copy readme.txt to the documents directory

$ cp readme.txt documents/

duplicate a file

STOP RIGHT CLICKING AND DUPLICATE A FILE ��

$ cp readme.txt readme.bak.txt

More advanced:

$ cp readme{,.bak}.txt
# Note: learn how the {} works with touch foo{1,2,3}.txt and see what happens.

copy a directory

STOP DRAG AND DROPPING A DIRECTORY, OR CMD/CTRL + C, CMD/CTRL + V A DIRECTORY ��

Copy myMusic directory to the myMedia directory

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

duplicate a directory

STOP RIGHT CLICKING AND DUPLICATE A DIRECTORY ��

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

move a file

STOP DRAG AND DROPPING 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 directory

STOP DRAG AND DROPPING A DIRECTORY, OR CMD/CTRL + X, CMD/CTRL + V A DIRECTORY ��

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

rename a directory

STOP RIGHT CLICKING AND RENAME A DIRECTORY ��

$ mv myMedia/ myMusic/

merge directories

STOP DRAG AND DROPPING TO MERGE DIRECTORIES ��

$ rsync -a /images/ /images2/	# note: may over-write files with the same name, so be careful!

create a new file

STOP RIGHT CLICKING AND CREATE A NEW FILE ��

$ touch 'new file'    # updates the file's access and modification timestamp if it already exists
# or
$ > 'new file'        # note: erases the content if it already exists

create a new directory

STOP RIGHT CLICKING AND CREATE A NEW DIRECTORY ��

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

show file/directory size

STOP RIGHT CLICKING AND SHOW FILE/directory INFO ��

$ du -sh node_modules/

show file/directory info

STOP RIGHT CLICKING AND SHOW FILE/DIRECTORY INFO ��

$ stat -x readme.md   # on macOS
$ stat readme.md      # on Linux

open a file with the default program

STOP DOUBLE CLICKING ON A FILE ��

$ xdg-open file   # on Linux
$ open file       # on MacOS
$ start file      # on Windows

open a file in any application

STOP RIGHT CLICKING AND OPEN WITH ��

$ open -a appName file

zip a directory

STOP RIGHT CLICKING AND COMPRESS DIRECTORY ��

$ zip -r archive_name.zip folder_to_compress

unzip a directory

STOP RIGHT CLICKING AND UNCOMPRESS DIRECTORY ��

$ unzip archive_name.zip

peek files in a zip file

STOP USING WinRAR ��

$ zipinfo archive_name.zip
# or
$ unzip -l 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 directory

STOP RIGHT CLICKING AND DELETE A DIRECTORY PERMANENTLY ��

$ rm -r my_useless_folder

list directory contents

STOP OPENING YOUR FINDER OR FILE EXPLORER ��

$ ls my_folder        # Simple
$ 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.

tree view a directory and its subdirectories

STOP OPENING YOUR FINDER OR FILE EXPLORER ��

$ tree                                                        # on Linux
$ 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.
# brew install tree

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 ��

$ bc -l

force quit a program

STOP CTRL + ALT + DELETE and choose the program to kill ��

$ killall -9 program_name

check server response

STOP OPENING A BROWSER ��

curl -i umair.surge.sh
# curl's -i (--include) option includes HTTP response headers in its output.

view content of a file

STOP DOUBLE CLICKING A FILE ��

$ 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.
$ less apps/settings.py

search for a text in a file

STOP CMD/CTRL + F IN A FILE ��

$ grep -i "Query" file.txt

search in all files in current working directory, quickly (entire disk in less than 15 minutes)

STOP CMD/CTRL + F IN A DIRECTORY ��

$ ripgrep -i "Query"
# brew install ripgrep

view an image

STOP USING PREVIEW ��

$ imgcat image.png
# Note: requires iTerm2 terminal.

show disk size

STOP RIGHT CLICKING DISK ICON OR OPENING DISK UTILITY ��

$ df -h

check performance of your computer

STOP OPENING YOUR ACTIVITY MONITOR OR TASK MANAGER ��

$ top

know whether your computer is under load, and whether it's due to memory or CPU

$ glances
# brew install glances

poweroff or reboot your computer

This can be useful when you're patching a server that is acessed via SSH and you don't have a GUI.

# poweroff
sudo shutdown -h now
# reboot
sudo shutdown -r now

locate USB drives

$ df

unmount USB drives

$ sudo umount /dev/sdb1

format USB drives

# FAT32
$ sudo mkfs.vfat /dev/sdb1
# NTFS
$ sudo mkfs.ntfs /dev/sdb1
# exFAT
$ sudo mkfs.exfat /dev/sdb1

check USB format

sudo fsck /dev/sdb1

Quick 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  Lets 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
Ctrl + F  Move cursor forward one character
Ctrl + B  Move cursor backward one character
Esc + T   Swap the last two words before the cursor
Alt + T   Same as Esc + T
Alt + F   Move cursor forward one word on the current line
Alt + B   Move cursor backward one word on the current line
Esc + F   Same as Alt + F
Esc + B   Same as Alt + B
Alt + .   Paste the last word of the most recently command
Tab       Auto-complete files and directory names

I can't remember these cryptic commands

You can always google or man the commands you are not familiar with. Or, checkout tldr, a collection of simplified and community-driven man pages.

 相关资料
  • You Don't Need JavaScript Please note these demos should be considered as CSS "Proofs of Concepts". They may have serious issues from accessibility point of view (keyboard navigation, speech synthesis

  • 前端发展很快,现代浏览器原生 API 已经足够好用。我们并不需要为了操作 DOM、Event 等再学习一下 jQuery 的 API。同时由于 React、Angular、Vue 等框架的流行,直接操作 DOM 不再是好的模式,jQuery 使用场景大大减少。本项目总结了大部分 jQuery API 替代的方法,暂时只支持 IE10 以上浏览器。

  • Yii 的学习曲线并不像其他 PHP 框架那样陡峭,但仍然需要一些基础知识。 PHP Yii 是一个 PHP 框架,因此请确保您 阅读并理解语言参考。 用 Yii 进行开发时,您将以面向对象的方式编写代码,因此请确保您熟悉类与对象以及命名空间。 面向对象编程(Object oriented programming) 对面向对象编程的基本理解是必需的。如果您不熟悉它,请选中其中一个 可用的教程,如

  • 问题内容: I imported a MySQL database. All the tables where successfully imported but not the functions. The only way I can execute SQL queries is through phpMyAdmin or with a PHP script (no SSH). Here’s

  • dont-break Checks if the node module in the current folder breaks unit tests for specified dependent projects. Relevant discussion at npm,Do not break dependant modules. Install npm install -g dont-br

  • you-get 是一个跨平台命令行视频、音频与图像下载工具,支持国内外常用的各种多媒体网站。 $ you-get 'https://www.youtube.com/watch?v=jNQXAC9IVRw'site: YouTubetitle: Me at the zoostream: - itag: 43