When running a command, you do not have to type the entire filename. This saves a lot of time and effort, and also helps prevent typos.
The Tab key is used to invoke filename auto-completion. See the following screenshot:
You only need to type enough characters to make the filename you want unique, and then press Tab. If you didn't type enough characters, you will hear the console beep (in most shells). If you now press Tab again, all of the possibilities will be displayed.
Change to your home directory, in my case it's:
cd /home/jklewis.
Create a directory using the following command:
mkdir Linuxbook
Change to it
Linuxbook
using the following command:cd Linuxbook ls > file2.txt ls > file3.txt ls > file4.txt ls > unique1.txt
Now let's create some dummy files; run using the following command:
ls > file1.txt
Now type
ls -la u
and then press Tab. The rest of the filename "unique1.txt" will appear. Press Enter.Now type
ls -al file
and press Tab. Nothing will happen, and your console may beep. Press Tab again. Now all 4 filenames will appear.Add a
4
, press Tab again, and then Enter. The commandls -la file4
will run.
This may look complicated or even clumsy but if you give it a chance you will become an expert in no time at all.