chevron_left chevron_right
Login Register invert_colors photo_library


Stay updated and chat with others! - Join the Discord!
Poll: Do we want another?
You do not have permission to vote in this poll.
Yes
100.00%
2 100.00%
No
0%
0 0%
Total 2 vote(s) 100%
* You voted for this item. [Show Results]

Thread Rating:
  • 0 Vote(s) - 0 Average


Tutorial Getting familiar with the linux command line [Part 1: Filesystem] filter_list
Author
Message
Getting familiar with the linux command line [Part 1: Filesystem] #1
Alright, so you want to learn about the cool part of Linux, do ya? Well, that is exactly what I intend to teach you in this tutorial. Notes, I am assuming that you are familiar with installing a Linux distribution (it generally does not matter which) and have one installed. If you do not meet these requirements, @roger_smith wrote a nice tutorial that explains it.

Okay, so the first thing we need to understand is the filesystem. This is what trips up most people. There are no drives on a linux filesystem. That part is easy to understand. What makes it tricky is even though there are no drives (A:, B:, C:, etc), there can still be access to other drives. Maybe it is best just to show you.

The Linux filesystem is broken into *basically* three different types of files: A directory, A device, and A file. There are many more types defined, but those are well beyond the scope of this tutorial. I make the assumption that you already understand what a file and a directory (folder) are. A device is not a real file, but it exists on the filesystem, it allows us to deal with our external devices (like drives) and interact with them.

The filesystem is a tree setup (just like Windows). It has what is called a root directory (the equivalent of the C: drive in most Windows systems). The root directory contains EVERY SINGLE FILE on the system. This includes files on other drives (we will get to that).

The location of the root directory is simply / (just like C:/, but without the C: ). There can be only one root directory, and it is ALWAYS named exactly that. Files, directories, or devices can be children of the root directory (or any other directory that is a child of the root). This gives us a tree structure.
[Image: arbo-unix.gif]

Now, if we have another hard drive on our system, if we want to access it, we must mount it. Mounting a drive simply means mapping the root directory of that drive to some folder in our filesystem tree. Usually, we make a folder in /mnt for this, say /mnt/second_drive and mount it there. Now, we create an empty folder /mnt/second_drive, mount our drive (which is a device in /dev, probably /dev/sdb1) to that folder, and suddenly /mnt/second_drive contains all of our files.

Code:
mount - mount a device to a folder OR view mounts
Usage:
sudo mount <device> <mountpoint>
OR
mount (view points)

Mount with no arguments:
[Image: cephx-F01_reference.jpg]

Code:
umount - unmount a device
Usage:
sudo umount <device>
OR
sudo umount <mountpoint>

Code:
cd - change directory
Usage:
cd <path>

Code:
ls - List files in directory
Usage:
ls (will list current directory)
OR
ls <directory> (list files in <directory>)

Let me explain the devices now. I am only going to explain hard disks, because they are simple. They reside in /dev and have the sdxy format. Making /dev/sdxy. What are X and Y you ask? X is a letter, A-Z which specifies the drive number (somewhat like Windows, except they always start with A for the first, B for 2nd, C 3rd, etc), and X is the partition number. Partitions are tricky, a normal (OEM) Windows install will have two drives (C:, and D: ) where D: is usually a recovery drive. This is not actually a second hard disk, but a partition. Partitions are logical divisions of physical disks. Most of the time, you will be working with only one partition.

Code:
lsblk - List block devices
Usage:
lsblk

The output of lsblk looks like this:
[Image: GtVTj.png]



Alright, now we have a few basic commands under us and understand how the filesystem works, we can get into the more complicated things. For reference, here is what you should know at this point:

Code:
mount - mount a device to a folder OR view mounts
Usage:
sudo mount <device> <mountpoint>
OR
mount (view points)
Code:
umount - unmount a device
Usage:
sudo umount <device>
OR
sudo umount <mountpoint>
Code:
cd - change directory
Usage:
cd <path>
Code:
ls - List files in directory
Usage:
ls (will list current directory)
OR
ls <directory> (list files in <directory>)
Code:
lsblk - List block devices
Usage:
lsblk
Code:
rm - Remove file
Usage:
rm <file path>
Code:
mkdir - Create directory
Usage:
mkdir <directory path>



Play around a bit, and next up I will explain a few more commonly used commands. But these are the majority of them.

[+] 2 users Like phyrrus9's post
Reply

RE: Getting familiar with the linux command line #2
This is a nice tutorial, however, the title is misleading if 90% of thread is talking about drives and mounting. If you wanted to get into basic commands on the linux command line, you should've at least introduced things such as cat, nano, echo, etc.
XMPP - wrath@xmpp.jp

Reply

RE: Getting familiar with the linux command line #3
At a certain point you stop wanting to finish it if nobody is interested. Stopping it here was simply as a testing the waters thing. If people want to see the rest I will gladly write it. Also, nano is not part of every standard distribution, so it won't be included.

(06-18-2015, 06:33 AM)nothing.nobody Wrote: This is a nice tutorial, however, the title is misleading if 90% of thread is talking about drives and mounting. If you wanted to get into basic commands on the linux command line, you should've at least introduced things such as cat, nano, echo, etc.

I also modified the title so that there is no confusion.
(This post was last modified: 06-19-2015, 03:25 AM by phyrrus9.)

Reply

RE: Getting familiar with the linux command line [Part 1: Filesystem] #4
I'd be interested in seeing the rest. I recently started running Ubuntu in a VM, (and in the event that my laptop gets fucking booted again) so it'd be highly beneficial on my part.

Reply

RE: Getting familiar with the linux command line [Part 1: Filesystem] #5
rather read http://www.tldp.org/LDP/Linux-Filesystem...rarchy.pdf

oreilly books could provide more information than you ever could idiot

Reply

RE: Getting familiar with the linux command line [Part 1: Filesystem] #6
(06-19-2015, 05:02 AM)warstrike Wrote: oreilly books could provide more information than you ever could idiot

Don't bash the guy (no pun intended). Phyrrus chooses to make these tutorial threads for SL, not for profit.

Reply

RE: Getting familiar with the linux command line [Part 1: Filesystem] #7
(06-19-2015, 05:09 AM)Chitoge Wrote: Don't bash the guy (no pun intended). Phyrrus chooses to make these tutorial threads for SL, not for profit.

And they can be useful. Some dumbass coming from Google will definitely appreciate it.
[Image: 7ajmN5P.jpg]

Skype: oni_sl (Add)
Steam: Oni | SL (Add)

Reply

RE: Getting familiar with the linux command line [Part 1: Filesystem] #8
(06-19-2015, 05:50 AM)Oni Wrote: And they can be useful. Some dumbass coming from Google will definitely appreciate it.

As always. Well, tomorrow I suppose I will write up a part 2. But really, part of the reason my visits here are so infrequent is because I cannot stand to put work into something to help you guys and get called an idiot for it. Honestly, I have better things to be doing with my time than writing these, but I do it to help out the community. I seriously hope that the problem gets taken care of. I know I am not the only one.

[+] 1 user Likes phyrrus9's post
Reply

RE: Getting familiar with the linux command line [Part 1: Filesystem] #9
(06-19-2015, 05:02 AM)warstrike Wrote: rather read http://www.tldp.org/LDP/Linux-Filesystem...rarchy.pdf

oreilly books could provide more information than you ever could idiot

Frankly, that was incredibly rude and inappropriate. For those of you who have never put together any type of guide like this before, it takes A LOT of work to get a remotely functional, simple guide put together, especially when you are including screenshots as visual aid.

I think this is a decent contribution to the linux knowledge base building here on SL. My hope is that some day we'll reach a point that the content will support a section dedicated to linux.
---
Click here to get started with Linux!

If I helped you, please +rep me, apparently we've started over on Rep and I'd like to break 100 again...

Inori Wrote: got clickbaited by roger

Reply

RE: Getting familiar with the linux command line [Part 1: Filesystem] #10
For those new to the Linux platform, this tutorial Is definitely worthy of It's objective.

It's very well defined, formatted, elaborated and Illustrated.
A job well done Indeed.
[Image: AD83g1A.png]

Reply






Users browsing this thread: 1 Guest(s)