I would like to build some aliases but can't find my .profile and in fact didn't see anything immediately in my user directory. Could you point me in the right direction please?
I'm also having trouble with aliases. I created a .bash_aliases file in my home directory like other Ubuntu-based distros but no luck there. I can create aliases one by one via the alias nickname="the command", but there's no persistence between boots or sessions with uxterm. I've also written a quick bash script that would automate the process of adding all my custom aliases each time I run it, but even running it once doesn't cut it(even as root).
I'll keep looking, but some help would be appreciated :D
I've found the .bashrc I'd normally look for in my home directory. It seems there is no user profile for bash yet, but there is a universal file here, /etc/bash.bashrc and by adding a list of alias commands at the bottom the aliases persist through separate uxterm sessions, and although I haven't tested it I'm sure it works through boots as well.
First, login as root. Then navigate to /etc Then, using a text editor(I like vim), edit the file bash.bashrc At the bottom add each alias you want, one per line. Write and quit editing the file, then restart your session.
Here's my list: # Alias list alias ll="ls -al" alias fedex="sudo apt update && sudo apt upgrade -y" alias agi="sudo apt install" alias agar="sudo apt auto-remove" alias acs="apt-cache search" alias find="ll | grep" alias documents="cd ~/Documents" alias downloads="cd ~/Downloads" alias desktop="cd ~/Desktop" alias music="cd ~/Music" alias videos="cd ~/Videos" alias ..="cd .." alias ...="cd ../.." alias ....="cd ../../.." alias e="exit" alias s="sudo" alias shutdown="sudo shutdown -h now" #requires root password alias restart="sudo shutdown -r now" #requires root password
I fixed this by going to ~/ and making a .profile file there and placing this in it: if [ -n "$BASH_VERSION" ]; then # include .bashrc if it exists if [ -f "$HOME/.bashrc" ]; then . "$HOME/.bashrc" fi fi
Then I created a .bashrc file at ~/ and used it as usual. After putting aliases and manually entering my PS1 into it (export PS1 doesn't seem to work), both my prompt and my aliases work perfectly. I added the --color option to my ls alias to add color to the contents of my directories.
@dub 24 - That's what I did after searching for it. I did appear the ~/.profile has to exist at terminal startup and is NOT created when you install LXDE, that's what it looks for. Just to chime in a little for those that may be new, here is a step by step of what I did.
You really do not want to get used to mucking around with system files, like what is in /etc., at least suggested by others and my own experience. Setting aliases in /etc/bash.bashrc as you might know will setting the aliases for all users/globally. I had the same issue yesterday and spent some time on the forums to find out just how to 'properly' setup your aliases. This follows 'common Linux practice' and also enables you to be able to have a 'transferable' alias file between other systems that you may work on. I know it looks redundant, however it will keep you from mucking with system files and will be able to have a alias file to archive and keep with you on a USB or what have you.
Create the following files if they do not exist in your ~/ directory