can't find directory and file created with ubuntu
Andrew Mclaughlin
So I downloaded ubunto to start working with command line. It seems ubuntu created a directory that it named my username in my desktop (as discovered via pwd). I since created a file called colors.txt file using nano just for some practice. Using the ls command confirmed I created colors.txt.
However, I cannot find a folder that is called my username, or the file called colors.text anywhere on my computer. Is this normal? Where could this directory and colors.txt be?
42 Answers
You can use the find command to "find" files and folders on your disk.
Since your file is most likely in your home folder, first run this command, to scan the home folder:
find $HOME | grep "colors.txt"This command will output all results matching "colors.txt". For example, it may return something like this:
/home/<your_username>/Desktop/colors.txtIf so, that is the location of your file.
If instead, the command returns no output, you may wish to try scanning the entire disk. Do note that this will take some time, especially if you have mounted volumes:
find / 2> /dev/null | grep "colors.txt"The 2> /dev/null will hide error output, since some directories on the root filesystem are inaccessible. However, this command should output the location of "colors.txt" on your drive. You will see multiple results if it appears more than once.
Hopefully this helps you.
1Use the find command
find . -iname "colours.*" -printthe . after the find is to specify the start directory (in this case the current). For example to search the Designs directory
find Documents/Designs -iname "colours.*" -printthe '-iname' ignores case, and will match
- Colours.txt
- colours.txt
- CoLoUrs.txt
Use '-name' to be strict about names
The -print says what action is is redundant, so you could leave it out.
You could user other actions, for example
find . -iname "colours.*" -delete