This is probably a very simple thing but I can’t find an answer, possibly because I don’t know what terms to use in search.

How do I use an alias of a path with mv or cp? Or even cd?

In /etc/bash.bashrc I have: alias docs=‘/media/docs

cd docs Gives “No such file or directory”

Yet: docs Gives “Is directory”

With alias docs=‘cd /media/docs’ and by typing docs I get into the directory. Obviously I can’t use that alias with mv or cp though.

Maybe this isn’t even an intended use of alias but still. Why doesn’t it work?

  • just_another_person@lemmy.world
    link
    fedilink
    arrow-up
    3
    ·
    18 hours ago

    This is a bad idea for a number of reasons. Instead, if you move files to a specific location frequently, you want to make a symbolic link to that location instead. It acts as a circuit breaker in case something about your environment changes or breaks.