A Linux du command every day

Source: Internet
Author: User
Tags syslog disk usage

The Linux du command also looks at the space used, but unlike the DF command, the Linux du command is a view of the space used by the file and directory disks, or some difference from the DF command.

1. command format:

du [Options] [file]


2. Command function:

Show each file and the disk usage space for the directory


3. Command parameters:

-S or--summarize only show totals, only the last plus total value is listed

- h or--human-readable to improve readability of the information in k,m,g units


4,

command:

    du   and  du-h

output:

[Begin] 2016/1/6 19:42:23[[email protected] ~]# ls -al total dosage  148dr-xr-x---.   6 root root  4096 1 month    6 16:40 .dr-xr-xr-x.  26 root root  4096 1 month    5 23:45  Drwxr-xr-x   2 root root  4096 1 Month    6 16:40  A-RW-------.   1 root root  9421 12 Month  31 16:54  Anaconda-ks.cfgdrwxr-xr-x   2 root root  4096 1 Month    6  16:40 B-RW-------   1 root root   652 1 Month     6 10:20 .bash_history-rw-r--r--.   1 root root    18  5 Moon   20 2009 .bash_logout-rw-r--r--.   1 root root    176 5 Month   20 2009 .bash_profile-rw-r--R--.   1 root root   272 12 month  31 16:55 .bashrcdrwxr-xr-x    2 root root  4096 1 Month    6 16:40 c-rw-r--r-- .   1 root root   100 9 Month   23 2004 .cshrc-rw-r--r--    2 root root  1026 1 Month    6 16:32  Fstab1lrwxrwxrwx   1 root root     6 1 Month     6 16:36 fstab2 -> fstab1-rw-r--r--   2 root root   1026 1 Moon    6 16:32 fstab3-rw-r--r--.   1 root root  44933 12 month  31 16:54 install.log-rw-r--r--.   1 root root 10260  12 Moon  31 16:50 install.log.syslog-rw-r--r--.   1 root root   4149 7 Month    9 17:40 .screenrcdrwx------.   2 root root  4096 12 Month  31 16:54  .ssh-rw-r--r--.   1 root root   129 12 Month   4 2004  .TCSHRC-RW-------   1 root root   939 1 Month    6  09:05 .viminfo-rw-r--r--.   1 root root  4546 7 Month   16  17:33 .vimrc[[email protected] ~]# du /root8/root/.ssh4/root/c4/root/b4/root/ a144/root[[email protected] ~]# du -h /root8.0k/root/.ssh4.0k/root/c4.0k/root/b4.0k/ root/a144k/root[end] 2016/1/6 19:42:53

Description: Du displays the current directory and all directory storage sizes in the current directory, the storage units are not displayed, plus the option-H displays the default storage units.


Example 2: Show Specify space occupied by the file

Command:

du. SSH

output:

[Begin] 2016/1/6 20:06:46[[email protected] ~]# ls -al total dosage  148dr-xr-x---.   6 root root  4096 1 month    6 16:40 .dr-xr-xr-x.  26 root root  4096 1 month    5 23:45  Drwxr-xr-x   2 root root  4096 1 Month    6 16:40  A-RW-------.   1 root root  9421 12 Month  31 16:54  Anaconda-ks.cfgdrwxr-xr-x   2 root root  4096 1 Month    6  16:40 B-RW-------   1 root root   652 1 Month     6 10:20 .bash_history-rw-r--r--.   1 root root    18  5 Moon   20 2009 .bash_logout-rw-r--r--.   1 root root    176 5 Month   20 2009 .bash_profile-rw-r--R--.   1 root root   272 12 month  31 16:55 .bashrcdrwxr-xr-x    2 root root  4096 1 Month    6 16:40 c-rw-r--r-- .   1 root root   100 9 Month   23 2004 .cshrc-rw-r--r--    2 root root  1026 1 Month    6 16:32  Fstab1lrwxrwxrwx   1 root root     6 1 Month     6 16:36 fstab2 -> fstab1-rw-r--r--   2 root root   1026 1 Moon    6 16:32 fstab3-rw-r--r--.   1 root root  44933 12 month  31 16:54 install.log-rw-r--r--.   1 root root 10260  12 Moon  31 16:50 install.log.syslog-rw-r--r--.   1 root root   4149 7 Month    9 17:40 .screenrcdrwx------.   2 root root  4096 12 Month  31 16:54  .ssh-rw-r--r--.   1 root root   129 12 Month   4 2004  .TCSHRC-RW-------   1 root root   939 1 Month    6  09:05 .viminfo-rw-r--r--.   1 root root  4546 7 Month   16  17:33 .vimrc[[email protected] ~]# du .ssh8.ssh[[email protected] ~]#  du -h .ssh8.0k.ssh[end] 2016/1/6 20:07:07


Example 3: Show only the sum size

Command:

du-s

Output:

[BEGIN] 2016/1/6 20:08:35[[email protected] ~]# [[email protected] ~]# du-s/root144/root[[email protected] ~]# [[Email P Rotected] ~]# du-s/root144/root[[email protected] ~]# Du-sh/root144k/root[end] 2016/1/6 20:08:48


One linux du command per day

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.