Ubuntu – How to change directories in the terminal, and know which directory I’m in

command line

I am following the directions @ Ubuntu community Help; however, I am still confused about a few things. I researched it & found this post: using the terminal to change directory, but it's above me & I'm still not sure how to go about it. I'm new & need a bit extra direction so stick with me! 😉 The following is the script from my terminal:

christy@ubuntu:~$ ls
Desktop    examples.desktop     install-tl-unx.tar.gz  Pictures  Templates
Documents  install-pkgs.log     libnautilus-gksu.so    Projects  Videos
Documents  install-pkgs.log     libnautilus-gksu.so    Projects  Videos
christy@ubuntu:~$ cd/
bash: cd/: No such file or directory

How do I tell what is in which directory and how do I navigate the directory. I know I must be leaving out something simple.

Best Answer

In your session ls displays the content of the current directory (but not hidden files starting with a dot in the filename). You navigate into another directory by typing cd dirname. Here you have to substitude "dirname" by a directory's name you want to change into. Normally you start out with your home directory as current working directory. In your case that is most likely /home/christy. If ls shows you a directory called "Template" you can change into "Template" (=make it your current working directory) by typing (mind the space) the command:

cd Templates

you will change your current working directory to "Templates" or print "No such file or directory", if a dir of that name does not exist in your current direcotry. Typing pwd will always give you the full patch to your current working directory including parents.

You can supply optional arguments to each command. For cd the string "Templates" was such an optional argument. If you type ls -a for instance, the ls command will print out hidden files as well. Or with ls Templates it will print the content of the Tempaltes directory instead of you current working dir's content. Arguments must be separated by at least one space from the command name and from each other. The lack of a space between the two was the reason your command did not work.

Since the space character has a special meaning, you will need to quote or escape it, if it's part of an argument. So if for instance you want to change your current working directory to "Source Files" you need to type one of these commands:

cd Source\ Files
cd "Source Files"

The upper line being "escaped" while the lower line is "quoted".

If you want to learn more the better guide for you might be: Introduction to Linux (pdf) (html)


Edit:

Okay now, sorry I didn't see your link there. Your post was a bit misleading, now I think I got you:

So you want to install tex-live from the source archive that is linked in the "Getting Started" guide you posted. To do that you must first remove any pre-existing installation of tex-live. You do that by opening a terminal doing this:

christy@ubuntu:~$ pwd 
/home/christy # <---- This is the directory you are working in
christy@ubuntu:~$ sudo apt-get remove texlive-*
[sudo] password for christy: 

At this point you have to enter you password and will be rewarded with a few boring messages, that I will omit here. Then you'll have to download the archive named install-tl-unx.tar.gz (you already did that and don't have to download it again, but I show you how to do it none the less just in case):

christy@ubuntu:~$ wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz

--2012-07-09 15:08:23--  http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
Resolving mirror.ctan.org... 80.237.159.15
Connecting to mirror.ctan.org|80.237.159.15|:80... connected.
HTTP request sent, awaiting response... 302 Found
# ... some more stuff like this ...
Saving to: `install-tl-unx.tar.gz'

100%[=====================================>] 2,530,831   --.-K/s   in 0.1s    

2012-07-09 15:08:23 (17.3 MB/s) - `install-tl-unx.tar.gz' saved [2530831/2530831]

Now that you have downloaded the archive you can unpack it

christy@ubuntu:~$ tar xvf install-tl-unx.tar.gz
install-tl-20120701/
install-tl-20120701/readme-txt.dir/
install-tl-20120701/readme-txt.dir/README.RU-cp1251
# ... bla bla skipping over some more messages like this ...
install-tl-20120701/readme-html.dir/readme.sr.html
install-tl-20120701/readme-html.dir/readme.ru.html
install-tl-20120701/readme-html.dir/readme.de.html

Now that you've unpacked the archive you can change into the directory that was unpacked.

christy@ubunut:~$ ls | grep install-tl-  # <---- with this line you find out the number
install-tl-20120701                      # <---- in this case "20120701"
install-tl-unx.tar.gz                    # <---- if just this is present with no number you did something wrong
christy@ubuntu:~$ cd install-tl-20120701 # <---- enter this number here
christy@ubuntu:~$ pwd
/home/christy/install-tl-20120701/       # <--- this is your new working directory

The number "20120701" is a timestamp saying which version of tex-live you have. This number might be different for you but the command ls | grep install-t1- will tell you what to use instead. If all this worked, you can run the install script from here:

christy@ubuntu:~$ sudo ./install-tl
[sudo] password for jan: 
Loading http://ftp.univie.ac.at/packages/tex/systems/texlive/tlnet/tlpkg/texlive.tlpdb
Installing TeX Live 2012 from: http://ftp.univie.ac.at/packages/tex/systems/texlive/tlnet
Platform: x86_64-linux => 'x86_64 with GNU/Linux'
# ... bla bla and so on bla ...
Actions:
  <I> start installation to hard disk
  <H> help
  <Q> quit

Enter command: I
# ... and so on ...

From here on just answer the questions you're asked by the install script and you should be fine.