View Full Version : [gnome] Help with a Terminal Commands

December 15th, 2008, 12:37 PM
I'm brand new to Linux & I am trying to learn my way through the Command Line. I have a few things that I can't figure out..

I used 'man <command>' but didn't find what I wanted. (By the way, once I finish using the manual for a command, How do I exit the manual? Do I have to open a new terminal each time?)

1.) When using the 'cd' command to change directories, how do I go to a folder with a space in the file name?

For eg. To navigate to a folder called 'My Games'

~$ cd My Games does not work. Is there an abbreviation that I have to use?

2. The same problem arisies with the 'file' command

For eg. To view information about a file called 'Screenshot 1.png'

~$ file Screenshot 1.png yields no results.

Please point me in the right direction.

Thank You

December 15th, 2008, 12:39 PM
Try enclosing the folder/file name with the space in quotes.

December 15th, 2008, 12:42 PM
quitting the man pages is done with "q".

as for filenames and paths, use TAB complete. Press TAB once to auto-complete, if it doesn't work, then there are more than just 1 options available. Press then TAB again to see all remaining possibilities.

cd /
cd ho

and now press TAB --> it will complete to "cd home"

December 15th, 2008, 12:43 PM
To exit the man pages press the 'Q' key :)

And to cd into places with names, you can do one of the following
cd My\ Games
file Screenshot\ 1.png Which "escapes" the spaces in the name :)


You can do as suggested above and run
cd "My Games"
file "Screenshot 1.png"

December 15th, 2008, 12:46 PM
It Works!!!!

Thank You for the amazingly blazingly fast replies...


December 15th, 2008, 12:54 PM
Bash has a completion mechanism, let say you are in the directory /tmp and you have there a folder called "Test Folder" which you want to enter. If you type
cd Te and hit the Tab key, then bash completes this to
cd Test\ Folder/ (in case there is no other folder there starting with "Te") and you can just hit return to enter the folder.

If you want to know more about commands possible with man type:

man man

December 15th, 2008, 12:55 PM

Other useful things you may want to know: find and locate. These two commands allow you to search for files and folders on your system.

For locate, you first update its database:

sudo updatedb

Then, look for what you desire:

locate <whatever>

find works similarly, but it takes more arguments when writing the command. For example, used with flag -type d will only look for directories, -type f will only look for files etc.


find . -name my-file -type f

This will look for a file named my-file in your current directory (that's the dot).



This will take you back yo your home directory. Other ways to navigate back to it are either:

cd ~your-username

cd /home/your-username

This can help you narrow down your searches...


December 15th, 2008, 12:55 PM
I highly recommend trying this bash tutorial:

Its very useful to build an understanding of bash and of file permissions.