Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: open SUSE 11.0, Fedora 7 and Mandriva 2007
Posts: 1,662
Rep:
Small help
The following command created directory called 'rubbish100'.
I didn't create it as a super user.
Where does it reside?
cd ~/ && mkdir .rubbish100
ni@linux-j5q7:~> cd ~/ && mkdir .rubbish100
ni@linux-j5q7:~>
ni@linux-j5q7:~> rmdir rubbish100
rmdir: failed to remove `rubbish100': No such file or directory
ni@linux-j5q7:~>
Where does it reside? How do I remove it?
first execute the "cd ~" command (change directory to /home/_username_ ) and if (and only if) it succseeds, execute "mkdir .rubbish100" after that.
so:
the command changed the working directory to ~ (the base of the home directory of the user who runs the command) - and then created a directory ".rubbish100" inside the /home/_username_ directory of the user from which the command was run/of the user you where logged in as.
"a && b" means execute a and following a successful exit, run b.
anyway, a file called "rubbish100" is very obviously not the same file as one called ".rubbish100" just as it is not a file called "bob" or "flipper_the_table_tennis_playing_baboon" they clearly have different names. no more confusion about that please.
"cd ~/ mkdir .rubbish100" is two commands crammed into one, so never going to do what it should. does this dir actually exist? you know how to use ls right?? you know to use the -a flag?
Last edited by acid_kewpie; 09-21-2008 at 03:39 AM.
cd ~/ --> It is obvious that this changes to /home/ni.
What is ' && ' doing?
I just tried without ' && ' and it worked fine.
Please read the following:
ni@linux-j5q7:~> cd ~/ mkdir .rubbish100
ni@linux-j5q7:~>
---------------------------------------
I tried in vain to remove it.
ni@linux-j5q7:~> rmdir rubbish100
rmdir: failed to remove `rubbish100': No such file or directory
ni@linux-j5q7:~>
ni@linux-j5q7:~> rmdir .rubbish100
rmdir: failed to remove `.rubbish100': No such file or directory
ni@linux-j5q7:~>
ni@linux-j5q7:~> rmdir /.rubbish100
rmdir: failed to remove `/.rubbish100': No such file or directory
ni@linux-j5q7:~>
How do I remove it?
Gins, this has been explained to you and it is very basic:
What is ' && ' doing? - as jomen said: first execute the "cd ~" command (change directory to /home/_username_ ) and if (and only if) it succseeds, execute "mkdir .rubbish100" after that.
You need to issue ls -la in your home directory - that will list all files and folders stored there. See if the folder .rubbish100 is there at all, if not it would give you a hint as to why you can't delete it.
and trying to delete /.rubbish100 will fail because you are asking the system to delete a file or folder from your root directory when the folder was created in your home directory.
See if the file or folder is in your home directory before you try to remove it.
You can change to your home directory anytime by typing cd by itself. Typing cd ~ or cd ~/ will do the same thing, but why waste time typing extra characters.
If you want to execute multiple commands on one line, use the semicolon to separate the commands. For your example
cd ; mkdir .rubbish100
cd && mkdir .rubbish100
The semicolon separator will run the next command weather the first command was successful or not. The && uses the exit status of 0 or true. If the first command was susccesful, the second command is executed. If not, the second command is not executed.
To remove a directory, type rmdir .rubbish100
Note: rmdir works only on empty directories, use rm -rf to delete a directory with files. Use with caution.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.