You-Dont-Need-GUI icon indicating copy to clipboard operation
You-Dont-Need-GUI copied to clipboard

Most recommendations differ from what the GUI would do.

Open mk-pmb opened this issue 7 years ago • 6 comments

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! :+1:

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

mk-pmb avatar Nov 09 '16 12:11 mk-pmb

Sorry for the title noise. I'll just stop and admit that I can't describe it as short as I'd have liked to: There are subtle but important differences in edge cases, and obvious differences in the usual cases.

Update: Also the recursive examples don't provide proportionate progress indication and estimated remaining time.

mk-pmb avatar Nov 09 '16 12:11 mk-pmb

Those sounds reasonable. I'm not exactly sure how to do it though. Maybe we could add a longer version for each commands.

stevemao avatar Nov 09 '16 22:11 stevemao

I think that's fair.

Maybe have two commands for each solution.

Copy a file

Novice

cp readme.txt documents/

Expert

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

styfle avatar Sep 14 '18 18:09 styfle

Novices should be at least as concerned about safeguards like --one-file-system, --no-clobber and quotes (see bumblebee link). We should thus list the potential risks, or at least call it "Novice (potentially dangerous)".

mk-pmb avatar Sep 14 '18 19:09 mk-pmb

It's definitely a good idea to have the silent or simple command and the lounder (and perhaps closer to what would happen on GUI) one.

Berkmann18 avatar Apr 03 '19 10:04 Berkmann18

I use mv -n when combining folders, n is noclobber

Also consider adding zip -e for "encrypt" (password protected) zip

flatroof avatar Apr 09 '21 09:04 flatroof