Solved

Basic Linux Command

Posted on 2002-04-15
3
187 Views
Last Modified: 2012-05-04
How can I see the sizes of the linux directory with sub-directory. e.g "dir /s" in DOS
0
Comment
Question by:kennycpu
3 Comments
 
LVL 40

Accepted Solution

by:
jlevie earned 30 total points
ID: 6943914
do your mean the total amount of space a directory and its subdir's occupies? For that you'd use 'du -s /path-to/some-dir'. Check 'man du' for more options.

If you want to see all of the files in a dir and subdirs use:

ls -R /path-to/some-dir
 -or-
ls -lR /path-to/some-dir
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6943965
ls -lR|awk '/^-/{bytes+=$5}END{print bytes}'
0
 

Expert Comment

by:pmonz
ID: 6947319
du -h <dirname>

where <dirname> is the name of the directory or . for the actual directory.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
1. Introduction As many people are interested in Linux but not as many are interested or knowledgeable (enough) to install Linux on their system, here is a safe way to try out Linux on your existing (Windows) system. The idea is that you insta…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now