Code Monkey home page Code Monkey logo

you-dont-need-gui's Introduction

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

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 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. remove all files of certain criteria
  22. list directory contents
  23. tree view a directory and its subdirectories
  24. find a stale file
  25. show a calendar
  26. find a future date
  27. use a calculator
  28. force quit a program
  29. check server response
  30. view content of a file
  31. search for a text in a file
  32. search in all files in current working directory, quickly (entire disk in less than 15 minutes)
  33. view an image
  34. show disk size
  35. check cpu usage, processes and RAM
  36. know whether your computer is under load, and whether it's due to memory or CPU
  37. poweroff or reboot your computer
  38. locate USB drives
  39. unmount USB drives
  40. format USB drives
  41. check USB format
  42. run command on all files of a directory
  43. check network connectivity to a remote address and port
  44. check DNS config of a domain
  45. check the ownership and registration of a domain
  46. Quick tips
  47. Hotkeys
  48. 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/

Go to table of contents 🔼

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.

Go to table of contents 🔼

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/

Go to table of contents 🔼

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/

Go to table of contents 🔼

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.

Go to table of contents 🔼

rename a file

STOP RIGHT CLICKING AND RENAME A FILE 👎

$ mv readme.txt README.md

Go to table of contents 🔼

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

Go to table of contents 🔼

rename a directory

STOP RIGHT CLICKING AND RENAME A DIRECTORY 👎

$ mv myMedia/ myMusic/

Go to table of contents 🔼

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!

Go to table of contents 🔼

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

Go to table of contents 🔼

create a new directory

STOP RIGHT CLICKING AND CREATE A NEW DIRECTORY 👎

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

Go to table of contents 🔼

show file/directory size

STOP RIGHT CLICKING AND SHOW FILE/directory INFO 👎

$ du -sh node_modules/

Go to table of contents 🔼

show file/directory info

STOP RIGHT CLICKING AND SHOW FILE/DIRECTORY INFO 👎

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

Go to table of contents 🔼

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

Go to table of contents 🔼

open a file in any application

STOP RIGHT CLICKING AND OPEN WITH 👎

$ open -a appName file

Go to table of contents 🔼

zip a directory

STOP RIGHT CLICKING AND COMPRESS DIRECTORY 👎

$ zip -r archive_name.zip folder_to_compress

Go to table of contents 🔼

unzip a directory

STOP RIGHT CLICKING AND UNCOMPRESS DIRECTORY 👎

$ unzip archive_name.zip

Go to table of contents 🔼

decompress files of any format

STOP RIGHT CLICKING AND UNCOMPRESS DIRECTORY 👎

$ unar archive_name.zip
$ unar archive_name.7z
$ unar archive_name.rar
$ unar archive_name.ISO
$ unar archive_name.tar.gz

Go to table of contents 🔼

peek files in a zip file

STOP USING WinRAR 👎

$ zipinfo archive_name.zip
# or
$ unzip -l archive_name.zip

Go to table of contents 🔼

peek files in a compress file of any format

STOP USING WinRAR 👎

$ lsar -l archive_name.zip
$ lsar -l archive_name.7z
$ lsar -l archive_name.ISO
$ lsar -l archive_name.rar
$ lsar -l archive_name.tar.gz

Go to table of contents 🔼

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.

Go to table of contents 🔼

remove a directory

STOP RIGHT CLICKING AND DELETE A DIRECTORY PERMANENTLY 👎

$ rm -r my_useless_folder

Go to table of contents 🔼

remove all files of certain criteria

$ find . -name "*.bak" -type f -delete

IMPORTANT: run find . -name "*.bak" -type f first to see exactly which files you will remove.

Go to table of contents 🔼

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.

Go to table of contents 🔼

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

Go to table of contents 🔼

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

Go to table of contents 🔼

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

Go to table of contents 🔼

find a future date

STOP USING WEBAPPS TO CALCULATE FUTURE DATES 👎

What is today's date?

$ date +%m/%d/%Y

What about a week from now?

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

Go to table of contents 🔼

use a calculator

STOP USING CALCULATOR WIDGET 👎

$ bc -l

Go to table of contents 🔼

force quit a program

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

$ killall -9 program_name

Go to table of contents 🔼

check server response

STOP OPENING A BROWSER 👎

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

Go to table of contents 🔼

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

Go to table of contents 🔼

search for a text in a file

STOP CMD/CTRL + F IN A FILE 👎

$ grep -i "Query" file.txt

grep

Go to table of contents 🔼

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

Go to table of contents 🔼

view an image

STOP USING PREVIEW 👎

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

Go to table of contents 🔼

show disk size

STOP RIGHT CLICKING DISK ICON OR OPENING DISK UTILITY 👎

$ df -h

Go to table of contents 🔼

check cpu usage, processes and RAM

STOP OPENING YOUR ACTIVITY MONITOR OR TASK MANAGER 👎

$ top

if you want some more details:

$ htop

Go to table of contents 🔼

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

$ glances
# brew install glances

Go to table of contents 🔼

poweroff or reboot your computer

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

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

Go to table of contents 🔼

locate USB drives

$ df

Go to table of contents 🔼

unmount USB drives

$ sudo umount /dev/sdb1

Go to table of contents 🔼

format USB drives

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

Go to table of contents 🔼

check USB format

$ sudo fsck /dev/sdb1

Go to table of contents 🔼

run command on all files of a directory

STOP CLICKING THE FILES ONE BY ONE 👎

$ for FILE in *; do echo $FILE; done

Go to table of contents 🔼

check network connectivity to a remote address and port

STOP USING NETWORK UTILITY

$ nc -vz www.google.com 443
$ nc -vz 1.1.1.1 53

Go to table of contents 🔼

check DNS config of a domain

STOP USING NETWORK UTILITY

$ dig www.google.com

Go to table of contents 🔼

check the ownership and registration of a domain

STOP USING NETWORK UTILITY AND THE WEBSITE OF DOMAIN REGISTRATION PROVIDERS

$ whois www.google.com

Go to table of contents 🔼

Quick tips

CLI tips

Go to table of contents 🔼

Hotkeys

Hotkey Description
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
Go to table of contents 🔼

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.

Go to table of contents 🔼

you-dont-need-gui's People

Contributors

altbdoor avatar ashleyharvey avatar berkmann18 avatar cht8687 avatar crazypython avatar dennisxzx avatar gutierri avatar h3xx avatar haroenv avatar hezhizhen avatar iamtalas avatar jakebrinkmann avatar koppor avatar lorenzck avatar majewsky avatar masonm avatar maujfernandezuvr avatar mischah avatar mortal avatar nosir avatar rjc avatar rohitrajak1807 avatar seasonedfish avatar sicaboy avatar stevemao avatar teddyhuang-00 avatar tomsaleeba avatar umr55766 avatar yfgeek avatar zwindl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

you-dont-need-gui's Issues

Shorter command: Windows open file with default program

start isn't required, if you have blah.txt or movie.mp4 or whatever, just typing

movie.mp4

Will open in default. Start is only rarely needed.
If the file isn't associated with anything, it'll show the "open with..." dialog which is easier than assoc and ftype for most people.
If you're the kind of crazy that thinks they can do a better job dishing out process priorities than the OS can schedule them, go ahead and start firefox with realtime priority and watch the fail. This used to be needed sometimes (back when we had one core) but these days it just interferes with the scheduler.
If you're running a Threadripper or Epyc with L3_SRAT_AS_NUMA enabled or NPS > 1 and want to make sure some long-running hardware intensive process gets thrown onto the same node the hardware. Usually the OS will do this when it starts performing heavy access; you could also set the affinity to the CCD's cores that correspond to where that node would be if NUMA nodes are off

assoc and ftype can set new ones from the command prompt since you won't get the usual "open with" window

Some examples are GNU-specific

Case in point - #quick-tips:

$ !!
$ sudo !!
$ !<word>
$ !<word>:p

are all specific to GNU Bash and won't work on, let's say OpenBSD's ksh(1), etc. so please mark them as such.

While we're at it, if we're at "You don't need GUI", probably best to get rid of that image and replace it with plain text, eh? ;^)

Also, these examples are GNU Coreutils-specific:

$ date -d "+7 days
$ date -j -v+7d

How about sticking to POSIX-only?

“Create a new file” suggests two totally different commands

There are two alternative commands suggested:

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

While both commands are OK for creating files, the ultimate meaning of them is different: e. g. if the file already exists, the former would just update the access timestamp on it, while the later will also remove its contents. It is probably worth noting, especially since this guide is aimed at the beginners.

that's why people complains that linux sucks

I know that some commands are useful and faster than GUI, but why the need of an terminal and a long command just for copy/paste an file? No wonder why Linux still has a low market share as a desktop OS

Missing some major concepts of GUIs

Most GUIs (at least from big vendors) are built with some basic concepts of user happiness in mind:

  • warn about potential accidents. (--interactive)
  • confirm success. (--verbose)
  • documentation optimized for inattentive readers. (man pages: conciseness)

More detailed explanation can be found in Joel's article "Biculturalism".

Most recommendations differ from what the GUI would do.

Most command examples currently shown do the operation way worse than what I'd expect thunar would do (and afair, does). Here's an attempt at fixing the most obvious differences.

-cp readme.txt documents
+cp --verbose --no-clobber --no-dereference --target-directory='documents' -- 'readme.txt'

stop right click and duplicate file

A core feature of the duplicate command is to automatically suggest an unused target file name, and prepare it in a way that helps users resume their work when they get distracted while deciding about the target file name. In that case they usually end up having a duplicate with the original name and a number, with content as it was at the moment they began their operation.

-cp readme.txt readme.bak.txt
+cp --verbose --no-clobber --no-dereference --no-target-directory -- readme{,.bak}.txt

copy a folder

-cp -R myMusic myMedia
+cp --verbose --interactive --recursive --one-file-system --target-directory='myMedia' -- 'myMusic'

duplicate a folder

-cp -R myMusic myMedia
+cp --verbose --interactive --recursive --one-file-system --no-target-directory -- 'myMusic' 'myMedia'
-mv readme.txt documents
+mv --verbose --interactive --target-directory='documents' -- 'readme.txt'

-mv readme.txt README.md
+mv --verbose --interactive --no-target-directory -- 'readme.txt' 'README.md'

-mv myMedia myMusic
+mv --verbose --interactive --target-directory='myMusic' -- 'myMedia'
-touch 'new file'
+magicmenu select-file-from /usr/share/file_templates/ --as %t \
+  --exec magicprompt suggest-filename --find-unused-suffix --basename %t --as %f \
+  --exec cp --dereference --no-clobber --no-target-directory -- %t %f

The mkdir examples are good, they even have quotes! 👍

-stat -x readme.md
+# Ubuntu says: stat: invalid option -- 'x'
+du --bytes 'readme.md' && du --human-readable -- 'readme.md'

The {,xdg-}open examples are good. Missing quotes shouldn't usually be too much of a problem here.

For the zip example, consider -y and quotes.

-rm my_useless_file
+rm -I --verbose -- 'my_useless_file'

-rm -r my_useless_folder
+rm -I --verbose --one-file-system --recursive -- 'my_useless_file'

You may wonder why I insist on quotes? You can easily clobber data without them. Forgetting the quotes usually causes the loudest anger when it happens with rm. (Example: bumblebee. the accident, the fix)

The ls example is okay, although it requires some good shell aliases to have similar selection of folder views and select them with similar ease. For thumbnail view on a pictures folder in a graphics-enabled command line shell, the discussion about the boundaries of "GUI" are left for another thread.

Should we use less directly, instead of being piped from cat?

In reference to the section "view content of a file", the recommendation to view a larger file is:

# if the file is too big to fit on one page, you can send it to a 'pager' (less) which shows you one page at a time.
$ cat apps/settings.py | less

Wouldn't less apps/settings.py be sufficient?

Two items to add to the list

(1) Add $(!!), recomputes last command

Comes in handy for things like these:

$ which python
/usr/bin/python
$ ls -l $(!!)
ls -l $(which python)
lrwxrwxrwx 1 root root 7 Apr 15  2020 /usr/bin/python -> python2

(2) Or find filename on whole file system, suppressing 'Permission denied' errors:

find / -name filename 2>&1 | grep -v 'Permission denied'

Add shell indicator

Some do work in the git bash on windows. Maybe its nice to have an indicator for that?

o i am laffin

STOP DOUBLE CLICKING ON A FILE
$ xdg-open file

STOP OPENING YOUR FINDER OR FILE EXPLORER
$ find . -print | sed -e 's;[^/]*/;|;g;s;|; |;g'

lol k i'll race you

rm for deleting?

We can use rm for permanent delete, for the noobs it might give an idea that it goes in to recycle bin, some clarification might be needed there.

make a cli for 'you-dont-need-gui'

hey, you could make a CLI for this. literally it could just echo the readme to stdout, so folks could grep it :P

thanks for making it!

Use directory instead of folder

These instructions are for *NIX systems, and as such they should refer to directories instead of folders (which is a Windows term).

An idea/partnership suggestion

Note: Let it be out in the open, self-promotion is a byproduct of this suggestion.

Hi, I have undertaken a holy quest to convince people to use the CLI/Linux/FOSS. In service to that quest, I have created tuterm. It's a bash program that allows you to write a transcript of commands. When you run tuterm, those commands are automatically reproduced as if a human were typing them. The user is then expected to repeat the commands.

I would love to cooperate with this repo in turning the README into a tuterm tutorial. We could also create an asciicast tutorial an put it as a gif inside the README itself, which would make it more attractive.

Using tuterm has the following benefits:

  • 100% repeatable
  • The users don't have to set up an environment/directory for testing the commands themselves (this is something that irritated me when I was a beginner)
  • User input is error-checked before running so there is no room for mistakes

The project (tuterm) is still young, so there may be bugs.

Looking forward to your reply!

Moving a file

Please, when moving a file to a directory always use a trailing slash at the end of the folder to avoid mistakes:

mv readme.txt documents/

For this reason

Jump Back to TOC

I exploring the list I found it annoying to click a link in the table of contents, examine, then (vimium gg) jump to the very top and scroll and locate the place in the TOC I left off.

Simple solution: Include links to TOC entry next to item in body

can't `stat -x`

$ stat -x README.md
stat: invalid option -- 'x'
Try 'stat --help' for more information.
$ stat --version
stat (GNU coreutils) 8.25

Arch Linux

Misleading title

"You don't need GUI" just sounds too loud. You've pretty much described the basic *nix commands which are used by the majority of people anyway. Go hardcore, push for Vim and Emacs as the editors, ncmpcpp as the music player, tmux as the way to get some viewport layout...

Well, what about tiling WMs like i3 or AwesomeWM?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.