Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Most recommendations differ from what the GUI would do. #6

Open
mk-pmb opened this issue Nov 9, 2016 · 6 comments
Open

Most recommendations differ from what the GUI would do. #6

mk-pmb opened this issue Nov 9, 2016 · 6 comments

Comments

@mk-pmb
Copy link

mk-pmb commented Nov 9, 2016

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.

@mk-pmb mk-pmb changed the title Most recommendations are flawed. Most recommendations do something other than the GUI would. Nov 9, 2016
@mk-pmb mk-pmb changed the title Most recommendations do something other than the GUI would. Most recommendations subtly differ from what the GUI would do. Nov 9, 2016
@mk-pmb mk-pmb changed the title Most recommendations subtly differ from what the GUI would do. Most recommendations differ from what the GUI would do. Nov 9, 2016
@mk-pmb
Copy link
Author

mk-pmb commented Nov 9, 2016

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.

@stevemao
Copy link
Member

stevemao commented Nov 9, 2016

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

@styfle
Copy link

styfle commented Sep 14, 2018

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'

@mk-pmb
Copy link
Author

mk-pmb commented Sep 14, 2018

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

@Berkmann18
Copy link
Contributor

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.

@flatroof
Copy link

flatroof commented Apr 9, 2021

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants