How to hide specific keys of the command to enter in the terminal?

For example, if you use:

stty echo 

I have to enter the entire team blindly.

Also, I considered the variant of aliases, but you never know, maybe there is something more improvised?

  • If you are talking about all sorts of passwords, then they simply do not need to be written in the terminal. - Alexey Ten
  • one
    Why not use alias? - Slava
  • The question does not reflect the essence of what you need. Can you paint in more detail what exactly you want to achieve? If you "reduce input", then this is alias If you "hide something when you type" after typing, press Ctrl + U - Hellseher
  • one
    + Some tools have their own alias mechanism ( git ) + Some options can be stored in files, for example, the password from the database is in .my.cnf . And what is the purpose of concealment? If the passwords, then ... try to get to the muscle through mysql -u... -p... with an explicit password, then look at cat /proc/{пид-процесса}/cmdline - the password will be hidden: mysql-uroot-pxxxxx . Maybe other teams can do that too - Total Pusher

1 answer 1

Use alias In the file ~ / .bashrc add a line, like

 alias update='sudo apt update' 

where update is a custom string that you invent yourself.


But try not to block other names, for example: 'apt' or 'exit' and others
And in quotes prescribe your string.
If you need a command call with arguments, just write them after your command. To make it work, you need to instruct the system to load the file with a new one:

 source ~/.bashrc