Difference between ./usr and /usr when running a command - linux

I have two directories in my new CentOS7:
Work_Folder1/my_project/linux_dev.cfg
Work_Folder2/my_project/linux_dev.cfg
If I try to run the command ./usr/bin/buildout -c linux_dev.cfg the build works fine from dir (1). If I try the same from (2) it says the ./usr/bin/buildout not exists.
After trying I see that from (2), /usr/bin/buildout -c linux_dev.cfg command works. So whats the role of . in here?

The command ./usr/bin/buildout looks for usr folder in the current directory.. While /usr/bin/buildout looks for usr in the root folder.. You might have usr folder in root as well as Work_Folder1, but not in WorkFolder2

The . indicates that you want to start looking for the buildout executable in the directory you are currently in. So for ./usr/bin/buildout, we are looking for a usr directory under the current directory, a bin directory under that, and a buildout executable under that.
Without the dot (i.e. /usr/bin/buildout), we begin looking in the root of the filesystem (i.e. /) for a usr directory, and then bin and buildout.
I'll bet if you look in your Work_Folder1/my_project/linux_dev.cfg directory, you'll find a usr directory. If you look in Work_Folder2/my_project/linux_dev.cfg, you won't.

Related

am in the Desktop but I cd is not see the desktop

How can I fixs that problem meanwhie I fix last code Selenim
Selenium but I am take same error. And cd is not see the Desktop but I am in the Desktop.
Here ~ is equal to /home/levidonates so when you type cd ~/Selenium it's actually cd /home/levidonates/Selenium but the folder Selenium is in your folder Desktop, so you need to type :
cd ~/Desktop/Selenium
~ is a shorthand for your home directory, /home/levidomates. The directories you're accessing are under there, not under the root, /. That is, ~/Desktop is not the same as /Desktop.
Firstly I see which folder do you try to enter / at the beginning? this is not true method.
/ characters means top of all folders root level.
You should not confuse it with the root user's home folder.
cd: change directory
cd .. : Back to the previous folder or up folder.
Firstly You can check your home folder
echo $HOME
then you must be enter pwd
if the your home folder /home/levidomates/
you must only cd ~ command
than cd Desktop
You shouldn't use / at the beginning of folders
Your absolute way to Deskotp is not correct...You forgot /home/levidomates
So then it should be cd /home/levidomates/Desktop instead of cd /Desktop

How to delete folder/files from Databricks mnt directory

I am running Databricks Community Edition and I would like to delete files from the following mnt directory
/mnt/driver-daemon/jars
I run the dbutils command:
dbutils.fs.rm('/mnt/driver-daemon/jars/', True)
However, when I run the command I get the following message (which basically means the folder hasn't been deleted)
Out[1]: False
Can someone let me know where I going wrong?
Ideally, I would like to delete all the files in the jars folder, however, if someone could just help showing how to delete the folder, that will suffice.
If dbutils.fs.rm() does not work you can always use the the %fs FileSystem magic commands. To remove a director you can use the following.
%fs rm -r /mnt/driver-daemon/jars/
where
%fs magic command to use dbutils
rm remove command
-r recursive flag to delete a directory and all its contents
/mnt/driver-daemon/jars/ path to directory
If you are referring to local /mnt/driver-daemon/jars ,it wouldn't be good idea to remove it since it is symlink to /databricks/jars directory and would impact driver functionality. The path /mnt/driver-daemon/jars/ resolves to dbfs:/mnt/driver-daemon/jars/ whose equivalent local file system directory /dbfs/mnt/driver-daemon/jars. If you want to delete local file system directories, you can prefix file: schema before the path (like file:/tmp/deleteme) with dbutils commands.
%sh ls -ltrh /dbfs/mnt/driver-daemon/jars /mnt/driver-daemon/jars
ls: cannot access '/dbfs/mnt/driver-daemon/jars': No such file or directory
lrwxrwxrwx 1 root root 16 Jul 2 23:14 /mnt/driver-daemon/jars -> /databricks/jars

how to list the classlist file with the absolute and relative path using LINUX command line?

I have a question regarding LINUX command line that i don't really understand:
Run the following commands.
$ cd
$ mkdir hw1-test
$ cd hw1-test
$ls /class/home > classlist
$ cd
what does the fourth command do?
Question:
Show the ls command you ran with the absolute path.
Show the ls command you ran with the relative path.
4th command lists out all the file in the directory to filename classlist in the same directory.
What is an absolute path?
An absolute path is defined as the specifying the location of a file or directory from the root directory(/). In other words we can say absolute path is a complete path from start of actual filesystem from / directory
What is the relative path?
Relative path is defined as path related to the present working directory(pwd). Suppose I am located in /var/log and I want to change directory to /var/log/kernel. I can use relative path concept to change directory to kernel.
Examples :
changing directory to /var/log/kernel by using relative path concept.
pwd
/var/log
cd kernel
Note: If you observe there is no / before kernel which indicates it’s a relative directory to present working directory.
Changing directory to /var/log/kernel using absolute path concept.
cd /var/log/kernel
Example 2: Present location is /abc/xyz, I am want to remove /abc/xyz/read/hello.txt file.
Using relative path:
rm read/hello.txt
Using absolute path:
rm /abc/xyz/read/hello.txt
SO ANSWERS TO YOUR QUESTIONS ARE
Show the ls command you ran with the absolute path
so absoulte path means full path.
Just open your terminal and you should know path of the directory you want to visit.
As you said in the question your path is /class/home/ i.e class is in root folder and home is inside it and you want to list out files in it so type
ls /class/home/ > classlist
Show the ls command you ran with the relative path
so now for relative path you will have to ennter into the directory one before the actual directory of home i.e. class
when you open your terminal you are in home directory by default i.e /Username/home
so type
cd .. //it will take you back into class directory
if you want to check you can check it with `pwd`.
and it will show your present working directory.
do
ls home/ > classlist

How to go to another directory sharing same parent directory?

I am beginner in linux and wondering about a shorter way to go a directory having same parent directory. Here I elaborate that.
dir1
- dir11
- dir12
- dir13
- dir14
Directory dir1 has sub-directories dir11,...,dir14. I am at directory dir13 and want to go to dir12. What is direct way to do this?
I can do
cd..
cd dir12/
But I am wondering whether I can do this in single step. Any ideas?
cd doesn't only take one directory to change to. You can provide a complete path to which you want to go.
You can simply type cd ../dir12
You can also go all nuts with cd ../dir12/../dir13/../dir14/..
Try also the following: type cd ..<press Tag twice>. This will list you all directories in the path you have given.
There are wildcards that cd can use. For example ~ is your home directory. cd ~ or just cd will change into your $HOME.
See man cd (in a terminal) for more.

Create a user level 777 directory inside root directory /

I need to put the Dropbox folder inside the root path, this way:
cd /Dropbox
I can't create first a normal folder because Dropbox automatically creates a Dropbox folder nested in it...
so it would result in this (like It does now)
cd /folder/Dropbox
What would be the problem if I give a "sudo chmod +w /"?
So I could initialize Dropbox inside the root path?
No problem if other files would be written in the / since there are no important files loaded in there, and anyway users wouldn't be allowed to write in the subfolder like /etc. Is that right?

Resources