Default Path variable for xfce minimal?

Hello!
I accidentally managed to wipe my path variable. Is there any way i can retrieve the default path variable for xfce minimal? I haven’t really installed anything.
Thanks!

It doesn’t matter, my PATH is still blank after 2 months, it was surely empty before

I can’t seem to run commands like ls, because it’s part of my path variable. I could manually add it, but I’m worried that there are other things I may have missed out

How? Did you wipe /etc/profile ?

Add this line at the end of your .bashrc file :- export PATH=/home/nazibalalam/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:$PATH (replace /home/nazibalalam here with ur own) and then resource your .bashrc file, source ~/.bashrc

Oh then, replace yours with mine :-

# /etc/profile

# Set our umask
umask 022

# Append "$1" to $PATH when not already in.
# This function API is accessible to scripts in /etc/profile.d
append_path () {
    case ":$PATH:" in
        *:"$1":*)
            ;;
        *)
            PATH="${PATH:+$PATH:}$1"
    esac
}

# Append our default paths
append_path '/usr/local/sbin'
append_path '/usr/local/bin'
append_path '/usr/bin'

# Force PATH to be environment
export PATH

# Load profiles from /etc/profile.d
if test -d /etc/profile.d/; then
	for profile in /etc/profile.d/*.sh; do
		test -r "$profile" && . "$profile"
	done
	unset profile
fi

# Unload our profile API functions
unset -f append_path

# Source global bash config, when interactive but not posix or sh mode
if test "$BASH" &&\
   test "$PS1" &&\
   test -z "$POSIXLY_CORRECT" &&\
   test "${0#-}" != sh &&\
   test -r /etc/bash.bashrc
then
	. /etc/bash.bashrc
fi

# Termcap is outdated, old, and crusty, kill it.
unset TERMCAP

# Man is much better than us at figuring this out
unset MANPATH

I set the path variable to something else, overriding what was originally there :stuck_out_tongue:

You messed up the file /etc/profile or did you just set the variable by “export PATH…” ?

If you did not do any modifications, just reboot. Then it should fix itself.

Didn’t seem to work. I definitely messed up the variable with export path.

This seems to work. Thanks!

then choose it as solution

I think i did? I set one of your replies as a solution i believe. Sorry its my first post here :smiley:

I say that you choose this one as solution

Although it’s working it’s more a workaround than anything else.

You should try figuring out what is going wrong in the first place.There you’d need to know how you messed it though :slight_smile:

1 Like

If you know for sure it is /etc/profile (an ordinary user doesn’t have the authority to change it), you could do the following if you retain the pacman cache:

===> pacman -Fx /etc/profile$   # what package owns the file
etc/profile is owned by core/filesystem 2021.01.19-1

===> cd /tmp  # do work in tmp directory

===> ls -l /var/cache/pacman/pkg/filesystem-2021.01.19-1-x86_64.pkg.tar.zst  # verify file exists in directory

===> cp  /var/cache/pacman/pkg/filesystem-2021.01.19-1-x86_64.pkg.tar.zst .  # copy to tmp

===> tar -tf filesystem-2021.01.19-1-x86_64.pkg.tar.zst | grep -i etc/profile  # verify file exists in archive

===> tar -xvf filesystem-2021.01.19-1-x86_64.pkg.tar.zst etc/profile # extract 1 file

===> meld etc/profile /etc/profile  # diff/compare the two files

If you don’t retain cache, you could still retrieve the single package from the repository and repeat the above process.

Or you could view the file in Manjaro’s git - Packages / Core / filesystem · GitLab.

Regarding your PATH, are you replacing it or concatenating to it… just something to think about.

For example, $HOME/.bash_profile:

if [[ -d "${HOME}/bin" ]] ; then    # does the directory exist on disk
  if [[ "${PATH}" != *"${HOME}/bin"* ]]; then # is the directory already part of the PATH
    declare -x PATH="${HOME}/bin:${PATH}" # add the directory to the existing PATH
  fi
fi

A neat way to display the PATH, to make it easier to read: echo "${PATH//:/$'\n'}".

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.