File System in linux vs File System in Windows

ravikumar js

New Member
Joined
Oct 8, 2020
Messages
3
Reaction score
0
Credits
29
Hello All,
Want to know is there any concept in Linux like windows C drive, D drive etc..(partition)
Please let me know.

Thanks,
Ravi
 


arochester

Moderator
Staff member
Gold Supporter
Joined
Apr 25, 2017
Messages
1,553
Reaction score
1,226
Credits
2,570
No. Linux disks are called things like sda and sdb. Then partitions are subdivided into things like sd1, sda2 and sda3
 
OP
R

ravikumar js

New Member
Joined
Oct 8, 2020
Messages
3
Reaction score
0
Credits
29
No. Linux disks are called things like sda and sdb. Then partitions are subdivided into things like sd1, sda2 and sda3
thanks,
But how can we find space of each folders under root
like
root
opt --> used and availablle
etc
var
usr
i want spaces of these
 

jglen490

Well-Known Member
Joined
Mar 10, 2020
Messages
736
Reaction score
500
Credits
4,106
Unless you initially set up your Linux environment to have a separate partition for each of those directories, they are not allocated separate spaces. The partition (sda1, sda2, etc.) has the space allocation. So if your allocated, as an example, 500MB to sda1 (because it's the efi partition), and 20GB to / on sda2 (because that's the "root" partition), and 100GB to /home on sda3 (for your user data and user config files), that's where the space is allocated. Any subdirectories will use as much space as they require for normal functions. These space allocations are either determined by default at install or by your actions at install. The default is to put everything under / and use the entire disk for that.

If you want to know what each partition looks like, use df -h which will produce something like this:
Code:
[email protected]:/$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            7.8G     0  7.8G   0% /dev
tmpfs           1.6G  1.7M  1.6G   1% /run
/dev/sda2        32G  8.6G   22G  29% /
tmpfs           7.8G   52M  7.8G   1% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           7.8G     0  7.8G   0% /sys/fs/cgroup
/dev/sda1       476M  7.8M  468M   2% /boot/efi
/dev/sdb1       458G  189G  246G  44% /home
/dev/sda3       172G   61M  163G   1% /home/extra
tmpfs           1.6G   16K  1.6G   1% /run/user/1000
 

dos2unix

Well-Known Member
Joined
May 3, 2019
Messages
1,014
Reaction score
690
Credits
5,124
jglen is right about the filesystems. I use df -h quite a bit.
But what if you want to the size of individual directories on a file system?
Sometimes I want to know what is taking up all the space on my filesystem.

cd /var
du -sh *
cd log
du -sh *
cd some_application_log_directory
ls -l
 

Tolkem

Well-Known Member
Joined
Jan 6, 2019
Messages
1,254
Reaction score
1,022
Credits
8,745
jglen is right about the filesystems. I use df -h quite a bit.
But what if you want to the size of individual directories on a file system?
Sometimes I want to know what is taking up all the space on my filesystem.

cd /var
du -sh *
cd log
du -sh *
cd some_application_log_directory
ls -l
You can use this
Code:
tree -L 1 -h
will list files and their sizes in human readable form in a tree view mode form appending K, M or G when appropiate. You can remove -L 1 to list recursively or increase the level tree will go down the directory, i.e, use -L 2 ... 3 ...
or
Code:
ls -1s --block-size=K/M/G *
will list files and their sizes in human readable form, where K=Kilobytes, M=Megabytes and G=Gigabytes, so use either one of them as you need.
You may also specify one or different file types
Code:
ls -1s --block-size=M *.{jpg,zip,mp3}
will list every .jpg, .zip and .mp3 files only within the current dir and their sizes in megabytes.

There's also a tool
Code:
ncdu

sk@sk_001-5.png


It's available in every distro. Read here for more info https://dev.yorhel.nl/ncdu

Lastly, you can change the view mode in your file manager to show more details like size, file type, mtime, atime and anything else your DE's file manager provides.

Hope this helps! :)
 

jglen490

Well-Known Member
Joined
Mar 10, 2020
Messages
736
Reaction score
500
Credits
4,106
All great suggestions!

Consider this, routinely monitor your filesystems at a high level - with your eyeballs! Get to know how your system is behaving. When a partition starts creeping up in size and you know you haven't done anything to contribute, then dive deeper using some of the tools that others have suggested above. And never forget to make backups of what is important to you. Stuff that comes most from your creativity is the stuff that is easy to lose, without a backup and recovery plan.

Make it a habit to pay as much attention to your filesystems as you do to content on the 'nets ;) You will soon discover that all kinds of good habits will make computing life very easy.
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Staff online

Members online


Top