Command Questions
Hi All,
I am trying to learn commands in linux. The man command is helpful to an extent. However, I was hoping you all could help provide a more layman understanding of the below commands. Links to recommended sources for more information would be great if you are aware of any. 1. ls /dev/sd* 2. cat /etc/fstab 3. df -h 4. free -m Thanks! |
I do not really understand what is your problem with 4, 3 and 2, would be nice to explain what is your problem with that exactly. I think those commands are quite simple, the most difficult one is probably the first one. /dev/sd* means all the disks you have, so ls /dev/sd* will list your disks. In order to understand it you need to be familiar with /dev and its content.
|
Quote:
The "free" command deals with memory usage (and availability) in Linux. the "-m" tells the program to present information in MB's. Please see here for more information. :) Regards... |
Sorry Pan64, I am brand new to linux.
I just started going for a degree in IT. This is a new world for me. Bare with me please :). I just started a course in Linux and am messing around with commands. I am looking to get a better perspective at what I am dealing with. |
#1? do you want the ls command, or what you are looking at after using the command?
ls (with no options) just lists filenames... The /dev/sd* lists all files that start with /dev/sd. As a side note, you get the same thing with "echo /dev/sd*", though the result is all one line. Now, if you want an explanation of what all the files are that exist in /dev, that is a different question. #2 do you want the cat command, or what you are looking at after using the command? cat by itself copies the contents of one or more files to stdout... (which happens to be the terminal) The contents /etc/fstab is a list of filesystems to be mounted during system boot, or to use filling in missing options from the mount command. The manpage on fstab describes each field of that file... and the manpage on mount will explain that command. #3 df reports on disk usage (df itself is short for "Disk Free"). The -h option requests the units to be more "readable". The "readable" part is that the size of disks are now in the TB range, so displaying them in units of 1K blocks makes the number really large. The default units is 1K (historical default - it made sense when the largest disk was only 5MB to 10MB. Even now, for some partitions, it can still make sense.) #4 free reports the memory and swap usage (though it is a bit vague). This was more useful when system memory was quite small - and running out a severe problem. Now, it is mostly useless; it can be used to recognize when something sucks up all of memory (and will overflow into swap) but other than that, not very useful. |
Quote:
|
I do appreciate all of your input!
So ls lists files, and /dev/sd* lists the disks I have. This might be a stupid question, but what type of disk are they referring too? My questions may be elementary so feel free to share recommended websites or youtube videos so I can learn more. |
Quote:
There are some other interesting references to the same disks: /dev/disk/by-id identifies the vendor/model/serial number the disk reports. the /dev/disk/by-label identifies the filesystem labels given to disk devices. The /dev/disk/by-path provides access by identifying the controller connections (on pcs the PCI addressing) where available. Then there is /dev/disk/by-uuid which uses the UUID. There are also logical volumes(I belive it is /dev/lv*, though I don't have any at this time), the multiple disk driver layer (/dev/md*) all of which reside in /dev. |
Quote:
|
My 2 cents. For question number 1 & 2:
1 - ls /dev/sd* refer to this link: http://www.linfo.org/wildcard.html or search the web for Linux wildcard operators :) 2 - cat /etc/fstab prints the output of any text file to the screen or basically view the content of the file without opening it. Cheers.. Good luck! enjoy learning.. |
Quote:
Now if you mean without EDITING the file, then yes (editing would be a different command). But there is no way to know what is in a file without opening it and reading at least part of the file. Quote:
|
Thanks for the heads up, Jpollard.
Yeah technically, no way to read the file without opening it. :) |
Quote:
5 point penalty hahaha :p stick to the question at hand. |
First you would need to know the meaning of the 4 commands you have in question and then the options alongside them.
ls = The ls command is used for listing. There are many options for this command depending on how you would like to list files in a directory. /dev/sd* = This directory contains files for the system devices. The sd* revers to your HDD's . They normally start with sda then sdb and so forth. You will also see sda1 for example, which indicates there is a partition on the drive. The "1" refers to the first partition on the drive. cat = The cat command is used to view the contents of a file such as config or normal text files. /etc/fstab = The fstab file contains the mount points that will be mounted on boot. You can configure the fstab file and add other mnt points that you would like to be mounted on boot df -h = This command will list your filesystems -h = The "-h" option lists the filesystems in human readable format. free = This command will display the system memory such as the physical memory as well as swap. -m = This will display the memory in mega bytes |
Quote:
|
Have you heard the one about write-only-memory...? :)
Play Bonny! :hattip: |
Quote:
|
:-) I thought about mentioning file system debuggers. But you have a very hard time accessing the raw data blocks directly. You CAN open the disk device... but then you have to interpret the filesystem architecture to find the blocks...
|
All times are GMT -5. The time now is 12:46 AM. |