LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-27-2010, 01:38 PM   #1
sanjayagayan
Member
 
Registered: Feb 2010
Location: Sri Lanka
Posts: 59

Rep: Reputation: 15
How to change to a dirrectory in ubuntu


I can change to a nother directory in home folder using cd command.I have several partitions in my hard drive.But i want to know ho to cheng to a directory in nother partition or flash drive using command line.how can i do that
 
Old 07-27-2010, 01:48 PM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
You do that the same way you use the `cd` command to navigate around your home folder.

Remember, everything is somewhere off of the / directory (that means root of the filesystem, not the "root user").

Other disks or partitions are going to be mounted somewhere, i.e. onto a folder somewhere. The `mount` command will show you what is mounted where.

So, if you want to `cd` to some flash drive partition, and that partition is mounted at /media/usb/ then you would do:
Code:
cd /media/usb
If you omit the leading slash, then the `cd` command expects to find the folder you tell it to go to, inside the current directory you are in. Use the leading slash for cd'ing to absolute paths; omit it to cd to paths off of your current directory.
To go backwards one or two or three levels, use:
Code:
cd ..
cd ../..
cd ../../..
To cd to your home directory, use:
Code:
cd ~
There's probably more in the man page (or maybe not much more, as cd is a pretty simple tool):
Code:
man cd
 
1 members found this post helpful.
Old 07-27-2010, 04:13 PM   #3
jefro
Moderator
 
Registered: Mar 2008
Posts: 15,374

Rep: Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198
cd may also bring you to home. Haa. Sasha missed one finally! Ok I gave her a did it help point.

Might help to know paths. They can sometimes help in less direct moves.

Flash drives may be found in one of two places usually. /mnt or /media. It would help us to know your distro too for exact help.

Partitons may be something either a name or somewhat of a drive code. Like /hda1 or sda2 or such. Might even show up as /Maxtor 60lmcbw whatever.

Last edited by jefro; 07-27-2010 at 04:14 PM.
 
1 members found this post helpful.
Old 07-28-2010, 12:56 PM   #4
sanjayagayan
Member
 
Registered: Feb 2010
Location: Sri Lanka
Posts: 59

Original Poster
Rep: Reputation: 15
I change to dev directory using
"cd /dev" command.There are several partitions in my heard disk.So i try to go to sda7 partition using cd sda7.It says sda7 is not a directory.So please if someone can , teach me how to go to a folder inside sda7 partition using command line.Every time, when i want to do some work in a folder in separate partition,i have to copy the folder to Desktop.Because i don't know how to go to that folder using command line.
 
Old 07-28-2010, 01:13 PM   #5
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
The stuff in the /dev folder is mostly NOT folders; therefore you cannot cd into any of that stuff, except the very few places in /dev that actually are folders. However, cd'ing into those folders will not get you where you want to go.

Follow along here, doing the same commands I do, on your machine:
Code:
sasha@reactor: mount
/dev/root on / type ext4 (rw,noatime,barrier=1,data=ordered)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
usbfs on /proc/bus/usb type usbfs (rw)
tmpfs on /dev/shm type tmpfs (rw)
/dev/hda12 on /home type ext4 (rw,noatime)
sasha@reactor:
So, see above I typed mount. That tells me what hard disk partitions are mounted, and it tells me WHERE they are mounted. That is the important part - WHERE the partition is mounted.

Let's look at my last line from above:

Code:
/dev/hda12 on /home type ext4 (rw,noatime)
That line, says that /dev/hda12 (partition #12 on my /dev/hda disk) is mounted on /home. So, if I want to go into my /dev/hda12 and see what's in there, I would do this:
Code:
sasha@reactor: cd /home
Below is what NOT TO DO because it will not work:
Code:
sasha@reactor: cd /dev/hda12
bash: cd: /dev/hda12: Not a directory
sasha@reactor:
See? Did not work. You must cd into folders, not devices.

Try that - if you need further help, just ask.
 
1 members found this post helpful.
Old 07-28-2010, 01:31 PM   #6
MrCode
Member
 
Registered: Aug 2009
Location: Oregon, USA
Distribution: Arch
Posts: 864
Blog Entries: 31

Rep: Reputation: 148Reputation: 148
Quote:
Originally Posted by sanjayagayan
I change to dev directory using
"cd /dev" command.There are several partitions in my heard disk.So i try to go to sda7 partition using cd sda7.It says sda7 is not a directory.
The files in the /dev directory aren't really "files" in the traditional sense. They're what are called "device nodes", and are used by the OS/kernel to directly access all the devices currently attached to your machine.

In any UNIX-like OS, everything is a "file", i.e. it is an object that can be written to/read from, and has permissions/flags/etc.

One example that somewhat demonstrates how this works is if you type cat /dev/urandom > /dev/dsp into a terminal (turn your speakers way down though! ). What this does is it redirects the "contents" of /dev/urandom (the pseudorandom number generator) into /dev/dsp (the device node for the audio controller), resulting in white noise. You're reading from one device "file" (/dev/urandom) and writing to another device "file" (/dev/dsp).
 
1 members found this post helpful.
Old 07-29-2010, 12:39 PM   #7
sanjayagayan
Member
 
Registered: Feb 2010
Location: Sri Lanka
Posts: 59

Original Poster
Rep: Reputation: 15
Thank

I got the answer,and now i can do it thanks to all of your help.Thank you very much.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
WEP Encryption Key:26chars_what choices must change in ubuntu 9.10 for the new change lse123 Linux - Newbie 1 03-02-2010 03:38 AM
[SOLVED] How do I change ca.archive.ubuntu.com to ca2.archive.ubuntu.com at the command line kennymw Linux - Newbie 3 09-01-2009 03:52 AM
Xorg and Kernel Source Dirrectory? (Core 5) Nuvious Fedora 2 04-18-2006 04:19 AM


All times are GMT -5. The time now is 12:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration