LQ Poll: What's your favorite Linux terminal trick?
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I do not use the commands frequently and I am VERY careful when I mess with any files.
The problem is that they have the same name as the original ones whilst doing something significantly different.
This will cause problems down the line, unless your sudo password timeout is 0.
ondoho - completely agree with your approach, but your alias hides the very useful scp command.
Another reason not to rename/modify existing commands is two-fold. These commands become habit and if you ever use another system you are likely to use them expecting the modified behavior and you may be unpleasantly surprised. This is best illustrated by an alias for rm that adds the -i flag. Typing rm on the other system will just remove the files without the expected prompt.
The other side of this, is that if you ever let someone else use your system, they will see unexpected behavior when they issue modified commands. Even if you don't allow anyone access, if you are asking for help with a problem and show someone else what you did, they will not be aware of the modified behaviors and may misinterpret what you are showing them.
ondoho - completely agree with your approach, but your alias hides the very useful scp command.
I never said that that's my approach!
I just wanted to point out that there might be a better way to do this, with a quick suggestion.
I overlooked that by that scp would be masked. I edited the post in question.
Most old UNIX hands will likely ctrl-d out rather than closing the terminal window through any other means.
Thanks. I tried that last night and it works great. Never thought to try <ctrl><d> as 'exit' always worked in Windows and Linux. <ctrl><d> doesn't work in Windows... You just get a ^D displayed there at the prompt.
Thanks. I tried that last night and it works great. Never thought to try <ctrl><d> as 'exit' always worked in Windows and Linux. <ctrl><d> doesn't work in Windows... You just get a ^D displayed there at the prompt.
Doesn't work in Windows... Are we caring about this? lol
Well, no . At work I work in Windows land, at home I am Windows free and only run Linux (do have Win 7 installed in a VM for a special use case). Have been for years. So have a foot in both worlds. The ^D was just an observation . That said, I don't work with 'bash' in Windows. I do use mingw and mingw64 C compilers for one of our SCADA applications.
#!/usr/bin/bash
# vh: two-line script to view only hidden files
# and directories in $HOME
cd $HOME
ls -lhA |awk '{print $9}' |ls -l $(awk '/^\./ {print}') |less
Well, thank you for that, it is almost what I was looking for. I will probably just pop that as an alias into my .bashrc, without the -d flag and get rid of the script.
test -n "$PS1" -a -x "`which zsh`" && {
echo Replacing bash Interactive Login shell with zsh
exec zsh --interactive --login
}
:-D
... I like to have the root user default to bash on my various machines but running interactively (also as root) I, for various reasons ( https://www.linuxquestions.org/quest...ml#post6176723 ), always use zsh ... sure often as simple as
Code:
ssh -t root@host.domain.my zsh -l
but with this "trick" in .bash_login I can just ssh root@host and also works when logging in on the console as root :-)
True, but read in Zsh has a similar option -k for this. And also option -q that is well-suited for the case described by Cabbie001 in #230.
absolutely, and it's nice ... for '#!/bin/zsh' scripts :-)
I'm not criticizing, all I'm trying to say is that if one uses shell-specific (non-Posix) features, remember to indicate that in you script instead of by default prefixing all shell scripts '#!/bin/sh' (which is not that uncommonly seen in bash-specific scripts)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.