Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
in old days when we used to have DOS and we have 2 or more partition we go through it by using "c: and enter" to go drive C or "d: and enter" to go drive D and so on
Can anybody tell me plz how i can do that in Linux
You need to mount the partitions. Read the man page for mount for details on how to do so. Once you've mounted the partitions (on different directories, obviously), you can just cd to those directories as normal.
Edit: it might help if you told us which distro you're using. Some automatically mount partitions for you.
Well...we still have DOS, but why would anyone use it when there is Linux?...
I would advise you to learn directly how to do things in Linux and not try to find the equivalents for specific DOS tricks. The Unix/Linux methods are vastly more powerful, and if you simply try to extrapolate from DOS, you'll miss all the good stuff.
Personally, I am eternally grateful that I never learned DOS---by the time I got a PC, Windows was the norm. Concurrently, I had learned some Unix and--when finally switching over to Linux, everything fell into place.
in old days when we used to have DOS and we have 2 or more partition we go through it by using "c: and enter" to go drive C or "d: and enter" to go drive D and so on
Can anybody tell me plz how i can do that in Linux
There are no drive letters in linux.
You have to mount partitions/drives to access them. see "man mount" for more info.
There certainly is some jargon here that may be unfamiliar to a Windows user.
First, "mount" can be thought of as "connect". Technically, what you are doing is connecting the partition's filesystem to the main directory tree. Once you do that,you can then browse to the partition using your GUI file manager, or "CD" to it in a terminal.
Distribution: Ubuntu, Slackware, Gentoo, Fedora, Red Hat, Puppy Linux
Posts: 370
Rep:
Linux views everything as files including disk partitions, devices, programs, etc. When a disk is partitioned in Windows the disk is assigned a Drive letter for reference (C:, D:, etc.) In Linux a partition is identified by a device name such as /dev/sda1 (1st drive, 1st partition) or /dev/sdb2 (2nd drive, 2nd partition). Linux drive partitions are then assigned directory names by mounting the partitions. For example /dev/sda1 is usually mounted as "/" which is the base directory, /dev/sdb2 may be mounted as /mnt/backup or /mnt/mirror or /mnt/disk2 or whatever you wish to use to refer to it.
When you browse disks in Linux you browse directories and files and the primary command for looking at the directory is:
Code:
ls
Linux commands use -flags to change the output of a command or how the command operates. These flags can be used individually or you can use more than one flag at a time. For example, to see a long listing of the ls command you would use the command:
Code:
ls -l
A long listing including all hidden files (those that begin with a [.] you would enter:
Code:
ls -la
Built into Linux are manual pages for each and every command. To see the options that are available for the ls command you would enter:
Code:
man ls
and this will list the manual page for your command.
You can also get help on any command by typing:
Partitions, in filesystem terms, are invisible. That is even if you have say, /home on another drive, it will always be /home rather than C:\home or D:\home like in DOS.
To mount a new drive, you use the mount command in this format:
mount [device] [directory to mount in]
So say you want to mount the drive /dev/hdb1 in the directory /disk2. You need to create that directory /disk2 with mkdir, then mount the drive in that directory with mount:
mount /dev/hdb1 /disk2
Now, when you navigate to /disk2, you will be able to access the entire drive.
//offtopic
Guys, sorry to interfere, but I think some of you overdoing it. OP didn't request much of additional info, and some of you are already writing "dissertations" about mount. Is it worth it? It won't be effective if OP didn't need additional information you provided (and spent time typing). Also and "man mount" explains most of things.
Distribution: Ubuntu, Slackware, Gentoo, Fedora, Red Hat, Puppy Linux
Posts: 370
Rep:
OP stated that he/she is a new Linux user and relates to Windows. My post was intended to explain in context to Windows what the equivalent of browsing files would be.
<<continuing off-topic>>
I find myself unconsciously guessing how much info will be useful to the OP. If I sense that it will be useful, I too will get verbose sometimes.
In this case, OP seemed thoroughly lost, but also posted follow-up. To me, that's a signal that verbose mode might be useful.
We could have told him to do "mkdir /mnt/sda1; mount /dev/sda1 /mnt/sda1" on the first post. But he would still have no clue on what's going on.
The main problem when coming from Windows is that the posix filesystem paradigm is way too different to the DOS/Win scheme. On a tipical posix filesystem, like the traditional linux filesystems, there are no "drives" in the same sense that you find them under Windows or DOS. Instead you have a root, which is represented as a slash (/), from that root (that might not even reside on a physical disk), different filesystems are attached. Some of them doesn't live on any concrete disk either, like /proc, some others are created at startup and do not contain regular files, like /dev.
Additional disks can be attached to our live filesystem at any given moment. So, your /dev/hda1 (first IDE disk, first primary partition) can hold the contents of your root filesystem, and then you can "mount" /dev/hda2 (first hard disk, second primary partition) to /home/. Simple as that. Once mounted on a given point of your directory structure, you can enter that disk by just doing cd to the directory where you mounted it. Disks and similar devices can be attached to your already existing file system and the kernel will take care about the "which device goes this into?" part. Applications just see directories, and don't care about the rest.
If in Win you used to link "My documents" to D:, in Linux you could mount /dev/hdb2 (or whatever) into /home, and cd home instead (or browse it with a graphical browser). Different graphical environments do this in different ways. That's why we use the command line terminology, because it's the most standard way and doesn't depend on a given desktop. Some desktops like kde try to make and abstraction to make this seem more like in Windows, however the underlying system is still the same and knowing this stuff never hurts.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.