Ubuntu: Can't manipulate files in ubuntu



Question:

I have a Problem on my Ubuntu machine. When I try to open some file in an editor like nano, vi or sudo gedit, nothing shows up, but nano ~/.bashrc works fine without any problem.

I have two user accounts on my Ubuntu system, and it's the same problem with the other user account.


Solution:1

You're trying to open the files with commands like this:

nano etc/apt/sources.list  nano conf/hadoop-env.sh  

In the first, you forget to add the root folder! Just add a slash before the rest of the file path:

nano /etc/apt/sources.list  

In the second, you need to add the Hadoop path:

nano $HADOOP_HOME/conf/hadoop-env.sh  

Also, you'll probably need to open them as root user, so add sudo before all the command (just like with gedit!):

sudo nano /etc/apt/sources.list  sudo nano $HADOOP_HOME/conf/hadoop-env.sh  


Solution:2

The reason you are having an issue manipulating files is that you must have the appropriate level permissions in order to manipulate those files.

So, for example, if you want to manipulate /etc/apt/sources.list, that requires that you use sudo to temporarily elevate your permissions so you can edit the file. On your current user account, try:

sudo nano /etc/apt/sources.list  

If you are already part of the sudo group, then you will be asked for your password. Once you type in your password, your privileges will be temporarily escalated so you can edit the file and save it.

If you are not part of the sudo group, another user on the system who has sudo access can add you by doing:

sudo usermod -a -G sudo your-user-name  

Learn more about Linux permissions here: https://www.linux.com/learn/tutorials/309527-understanding-linux-file-permissions


Solution:3

vi function in Ubuntu is different, you can install vim-nox or vim package So after that you can try it for the same file

use following command

sudo apt-get install vim-nox   

or

 sudo apt-get install vim  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »