Solved Hi, I need help with my .zshrc file

Solved issue

Pavin55

New Member
Joined
Apr 14, 2023
Messages
7
Reaction score
1
Credits
55
Is this a good place to ask? If so i will copy and paste it along with my questions
 


G'day Pavin55, Welcome to Linux .org

Glad you included so much detail (sarcasm)

Please....give us some background.....what are you doing/attempting to do?

What have you tried so far?

ETC ETC

we are not mind readers....that was last month's special....
 
Hi, well i wasn't sure this is the right place to ask. I have added aliases to the bash file and enabled autocompletion but i have to run source everytime i log into terminal to get the aliases to work. Autocompletion won't work at all even though i enabled it. I will copy and post the file tomorrow (on my laptop right now) and maybe someone can point out what i need to modify. ChatGPT has helped me to this point but were now both stuck.
 
Hi, well i wasn't sure this is the right place to ask. I have added aliases to the bash file and enabled autocompletion but i have to run source everytime i log into terminal to get the aliases to work. Autocompletion won't work at all even though i enabled it. I will copy and post the file tomorrow (on my laptop right now) and maybe someone can point out what i need to modify. ChatGPT has helped me to this point but were now both stuck.
The title line and your comments here do not match. I am no expert, but the title mentions ".zshrc", but in the post above, you mention adding "aliases to the bash file".

Which shell are you running, bash or zsh?
-> Could you be editing the ~/.zshrc file and expecting the aliases in the bash shell? Should you be editing the ~/.bashrc file instead?

(Confession Time: This is probably a bad habit and probably not recommended by the experts, but I put aliases in .profile. Keep in mind that I am mostly a Mac user, which may or may not explain this bad habit. I hope others chime in with their suggestions with the correct files for true Linux users.)
 
Sorry for the confusion, they are both shell configuration files I am running Kali on one machine and Parrot on another, when you edit them they look the same as far as what I was trying to do. Yes I believe you are correct I can make an alias file but I was just wanting to add a couple simple aliases with the existing ones.
At any rate I keep jumping into these rabbit holes, I am just going to use Fish and move on with my learning.
Thanks all!
 
I had never heard of the Fish shell until your post. Thanks for sharing.
 
Your saying I made my first ever contribution to the Linux community?!? That's awesome! Thank you
 
I am just going to use Fish and move on with my learning.
The advantage of zsh is that it is fully POSIX compliant and that fish isn't and the functionality(syntax highlighting, auto-suggestions, etc) that is builtin into fish you can add to zsh by using plugins. I use zsh and I just place my aliases in ~/.zshrc and they work without having to source that file first.
 
Last edited:
I have to source every time I open terminal just to get these simple aliases to work:

# Pauls alias
alias x='sudo apt update && sudo apt upgrade && sudo apt autoremove'
alias c='clear'

Then they work for the entire session. And yes I save my work and they show up in Nano when I open terminal.
 
I just installed Kali in a vm and I don't need to source ~/.zshrc at all to make the aliases work after I open a new terminal window. If you still want to use zsh you could just create a file in /etc/profile.d that sources your zshrc, something like this.
Code:
cat /etc/profile.d/szshrc.sh
source ~/.zshrc
 
OK I finally figured it out and learned quite a bit, thanks for steering me in the right direction.
For one thing root uses bash and user uses zshrc so that was messing me up. There was already an If/Fi statement leading to an alias file in root bash so I created and populated it, then I did the same for zshrc, now my aliases work in root or user.
Thanks again
 
The terminal defaults to zsh when you do a fresh installation of Kali Linux from the .iso file. (Tested on x86 version.) The terminal defaults to zsh in the downloadable VMware virtual machine version of Kali Linux, too.

The root account has not been enabled by default in Kali Linux since 2020. See:
https://www.kali.org/docs/policy/kali-linux-user-policy/

In case anyone cares. the root password is locked "!" in the .iso installation, but disabled "*" in the virtual machine version. See the respective /etc/shadow and /etc/passwd files.

(I was comparing the two versions about a week ago and still had the virtual machines handy. It was easy to boot them and look at the shadow and password files.)
 
I have to source every time I open terminal just to get these simple aliases to work:

# Pauls alias
alias x='sudo apt update && sudo apt upgrade && sudo apt autoremove'
alias c='clear'

Then they work for the entire session. And yes I save my work and they show up in Nano when I open terminal.
BTW, try ctrl-l instead of typing clear. Quicker and easier :)
 
Yeah I really need to get used to using ctrl, but at least now all I have to do is hit 'c'
 
BTW, try ctrl-l instead of typing clear. Quicker and easier :)
There is a difference between the commands "cntl+l" and "clear" on some terminals in X. Whereas "cntl+l" will usually still allow the user on the terminal to scroll back, (if that's been configured for the X terminal which it usually is by default), the "clear" command usually has that disabled so that it just provides the cleared terminal one expects, and that's it. On consoles, (text consoles with no X), scroll back is no longer configured in the kernel any more so it can't be done for current kernels.
 
  • Like
Reactions: Rob
There is a difference between the commands "cntl+l" and "clear" on some terminals in X. Whereas "cntl+l" will usually still allow the user on the terminal to scroll back, (if that's been configured for the X terminal which it usually is by default), the "clear" command usually has that disabled so that it just provides the cleared terminal one expects, and that's it. On consoles, (text consoles with no X), scroll back is no longer configured in the kernel any more so it can't be done for current kernels.
This is true - I scroll back often but also like a semi-clean slate lol :)
 
OK I finally figured it out and learned quite a bit, thanks for steering me in the right direction.
For one thing root uses bash and user uses zshrc so that was messing me up. There was already an If/Fi statement leading to an alias file in root bash so I created and populated it, then I did the same for zshrc, now my aliases work in root or user.
Thanks again
You actually don't need to use the root user to manage your system, you can do that with your main account using sudo.
 
BTW, try ctrl-l instead of typing clear. Quicker and easier
For others like me:
-> That is a "CTRL-L" to clear the terminal window without losing the scrollback buffer in Linux. (What you see in the posts above is a lowercase "L", not an upper case "eye".)

I found out the hard way by using "clear" and then losing the scroll back :)
It works the same for every version of Linux (and different desktop managers) that I have seen, but other operating systems are different.

In Windows, you always lose the scrollback buffer when you clear a command or PowerShell window. (The command is "cls" or "CLS" (for "clear screen"). In PowerShell, you can also use either the "CLS" or the "clear" command - they work the same.

On Macs, typing the "clear" command or CTRL-L in the the Mac Terminal window retains the scrollback buffer for text that is not visible in the window. Both operations are the same on Macs. To clear the Terminal and wipe the scrollback buffer, type: cmd-K (hold the Apple/propeller key and press "k"). That would look similar to opening a new Terminal window.
 

Members online


Latest posts

Top