

A listing of your home directory will show that the “smallfile” has been placed there. Remember the command cd and it moves you to home.

Now enter your home directory by entering cd. There are quite a few shortcuts, and you’ll become accustomed to them the more you use them.Ī listing of the Document directory shows “smallfile” was moved.
#Linux find file by name wildcard full#
You could have accomplished the same by using the full path name, or cp /home/pi/Documents/smallfile /home/pi/. The “smallfile” file should now reside in /home/pi. ) indicate the directory above the current directory, also referred to as the parent directory. To move the file, use the command mv smallfile.
#Linux find file by name wildcard how to#
The touch command creates an empty file, which we will use to demonstrate how to move, copy, and delete files. Listing the directory contents with ls will show a file named “smallfile”.
:max_bytes(150000):strip_icc()/linux-find-name-2f2401de720745ddae2c4110d48d2300.jpg)
You can create as many sub-directories as you want, but it could become harder to manage.Ĭhange to the Documents directory by entering cd Documents, and create a new file by entering touch smallfile. The full path name of that directory would be /home/pi/Documents/Correspondence/Family/letter_to_mom. Now, when you write a letter to your mother that you want to save, you can save it in the Family directory. You might want to make one for Family, Friends, Work, Legal, or whatever you feel you need. So under the Correspondence directory, create a few more directories. A listing of the directory with ls will show that the new directory is empty, which is no surprise since it’s new. Move into the Correspondence directory by entering cd Correspondence. For example, ls -al would list everything in a directory (including hidden files) in long format. configuration, the file will be hidden, and not be visible unless you add the -a flag to the ls command. If you make a file name that begins with a period, for example. Note that making directories beginning with a capital letter is optional, you could use all upper case, all lower case or any combination of letters, numbers, periods, or underscores, up to 255 characters in length. In this case, the Documents directory is the parent directory of the Personal and Correspondence directories. Its parent directory would be the one above it. A sub-directory is also called a child directory. Next, make a second directory called Personal by entering mkdir Personal. You should see a new directory Correspondence shown in blue. Enter mkdir Correspondence, then enter ls to view the contents of your new directory.

Start by creating a directory called correspondence. So let’s create some directories you can use to store files. If you type ls for a listing of your Documents directory, it will most likely indicate that there is nothing there. Your prompt will change to /Documents $ to indicate you are now in the Documents directory. To move into your Documents directory, enter cd Documents (change directory). Now, let’s see how you might want to organize your Documents directory. Once logged in you’re ready to begin exploring. ls -R – provides a recursive directory listing.ls -lh – lists with the long format, and includes the readable file size.ls -la – lists with the long format including hidden files.ls -l – lists with the long format, showing permissions.ls -a – lists all files including hidden files starting with “.”.
