Score:0

Unable to view the contents of the /etc/environment file

gu flag

Unable to see the contents of my '/etc/environment' file. I have tried using Vi and vim but still unable to see the contents . I wanted to add some commands in /environment file to $PATH for which I needed to see the contents of the file. Actually I was attempting to add the path variable using

export $PATH=$PATH:/sbin

but it shows the following error:

/sbin : not a valid identifier

Can anyone tell me how can I add the :/sbin to the $PATH variable and also how to check the contents of the /etc/environment file?

raddevus avatar
us flag
Have you tried this from terminal $ `sudo cat /etc/environment` ?
Rohan Jha avatar
gu flag
I tried as root user . As I am not a sudo user so sudo didn't work for me, and doing cat from root didn't show anything.
raddevus avatar
us flag
Oh, as I look at it, you don't need sudo. And if cat /etc/environment is displaying nothing then most likely there is nothing in that file. Try $ `nano /etc/environment` and see if the file is empty.
Rohan Jha avatar
gu flag
Yeah.. That works for me for the path. But I am not able to see the contents environment file using nano, as was same with vim
Score:1
us flag

set path variable in .bashrc

  1. nano ~/.bashrc note: user can edit this file no sudo needed
  2. go to bottom of file
  3. add line like export PATH=$PATH:/sbin
  4. CTRL-X (exit nano)
  5. save modified file -- type Y

open a new terminal and do $ echo $PATH You should see the added path.

Also you can use $ cat /etc/environment to view

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.