Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Bash script to get total size off of remainder calculated Post 303029593 by user3528 on Tuesday 29th of January 2019 10:33:24 AM
Old 01-29-2019
Thanks for the response. This is one of the pieces for my final script which I am building. The script's intended use is ./scriptname arg 1 arg2 arg3 arg4 from the command line. The arguments will get passed to the default bash variables ( $1 $2 $3 $4 etc.) hence I was using them in my statements. The use of bc is to future proof it if numbers are not integers but floating numbers.
 

10 More Discussions You Might Find Interesting

1. HP-UX

total size taken by directory

HI ALL, i am a beginner in unix world. can anyone please tell me the way to find total size taken by each directory (including size of all subdirectories and files) present under /var. e.g what is space occupied by /var/adm , /var/admin etc. its a simple question but still i dont know the... (2 Replies)
Discussion started by: jyoti
2 Replies

2. Shell Programming and Scripting

bash script working for small size files but not for big size files.

Hi, I have one file stat. Stat file contents are as follows: for example. H50768020040913,00260100,507680,13,0000000643,0000000643,00000,0000 H50769520040808,00260100,507695,13,0000000000,0000000000,00000,0000 H50770620040611,00260100,507706,13,0000000000,0000000000,00000,0000 Now i... (1 Reply)
Discussion started by: davidpreml
1 Replies

3. Shell Programming and Scripting

Remainder of x/y in shell script

Hi, Can anyone help me with the syntax for finding out remainder of two integers. Ex: 10/3 ... it should return 1. Is fmod function will be helpful here? I am not able to find out usage of it. Kindly help. Regards, Malay Maru (3 Replies)
Discussion started by: malaymaru
3 Replies

4. Solaris

command to find out total size of a specific file size (spread over the server)

hi all, in my server there are some specific application files which are spread through out the server... these are spread in folders..sub-folders..chid folders... please help me, how can i find the total size of these specific files in the server... (3 Replies)
Discussion started by: abhinov
3 Replies

5. Shell Programming and Scripting

total size

I have a directory that contains files like aaa-2010-05-30.txt ddd-2010-05-30.txt www-2010-05-30.txt i have total 2000 files, i need to calculate total size of files for *2010-05-30.txt like aaa-2010-05-30.txt 200MB ddd-2010-05-30.txt 10GB www-2010-05-30.txt 4GB Total 14.2 GB... (5 Replies)
Discussion started by: learnbash
5 Replies

6. Shell Programming and Scripting

bash script directory size

hello! i need to make a script that get a folder name in parameter and i get back the size of the folder include the subfolders! but i dont know how i need to start :S Example: a folder contain the followings a: drwxr-xr-x 2 user user 4096 febr 25 08.27 b -rw-r--r-- 1 user user 2 febr... (3 Replies)
Discussion started by: impish
3 Replies

7. Solaris

Need command to know the total size

:mad:i need command to know the total size of project in my system by Giga bit i try #du -s /*/projectname but i need total size for this project by G.B can you help me (6 Replies)
Discussion started by: ayman
6 Replies

8. Shell Programming and Scripting

Bash Script - File Size

I have a bash script. I need a modification for safety. my original bash script: mv /home/script/backup /home/script/backup2 mysql -u user -ppassword -Ddatabase --batch --skip-column-names -e 'select id, url from videos where url like "%http%" limit 1' | while read id url do youtube-dl... (1 Reply)
Discussion started by: tara123
1 Replies

9. Shell Programming and Scripting

Script to determine Date,TotalFile,total size of file based on date

I have file listed like below -rw-r--r--+ 1 test test 17M Nov 26 14:43 test1.gz -rw-r--r--+ 1 test test 0 Nov 26 14:44 test2.gz -rw-r--r--+ 1 test test 0 Nov 27 10:41 test3.gz -rw-r--r--+ 1 test test 244K Nov 27 10:41 test4.gz -rw-r--r--+ 1 test test 17M Nov 27 10:41 test5.gz I... (5 Replies)
Discussion started by: krish2014
5 Replies

10. Programming

Program or bash script to see total progress of copy

hi all, i want a program or to make a bash script to find out the total ETA/percent (would be nice aswell a progress bar) of a copy recursive command so lets say i do - cp -r /source_folder/ /destinatation_folder/ and when i run it i get no information on the screen of how the copy is... (20 Replies)
Discussion started by: robertkwild
20 Replies
LVREDUCE(8)                                                   System Manager's Manual                                                  LVREDUCE(8)

NAME
lvreduce - reduce the size of a logical volume SYNOPSIS
lvreduce [-A|--autobackup {y|n}] [-d|--debug] [-h|--help] [-t|--test] [-v|--verbose] [--version] [-f|--force] [--noudevsync] {-l|--extents [-]LogicalExtentsNumber[%{VG|LV|FREE|ORIGIN}] | [-L|--size [-]LogicalVolumeSize[bBsSkKmMgGtTpPeE]} [-n|--nofsck] [-r|--resizefs] Logi- calVolume{Name|Path} DESCRIPTION
lvreduce allows you to reduce the size of a logical volume. Be careful when reducing a logical volume's size, because data in the reduced part is lost!!! You should therefore ensure that any filesystem on the volume is resized before running lvreduce so that the extents that are to be removed are not in use. Shrinking snapshot logical volumes (see lvcreate(8) for information to create snapshots) is supported as well. But to change the number of copies in a mirrored logical volume use lvconvert(8). Sizes will be rounded if necessary - for example, the volume size must be an exact number of extents and the size of a striped segment must be a multiple of the number of stripes. OPTIONS
See lvm(8) for common options. -f, --force Force size reduction without prompting even when it may cause data loss. --noudevsync Disable udev synchronisation. The process will not wait for notification from udev. It will continue irrespective of any possible udev processing in the background. You should only use this if udev is not running or has rules that ignore the devices LVM2 cre- ates. -l, --extents [-]LogicalExtentsNumber[%{VG|LV|FREE|ORIGIN}] Reduce or set the logical volume size in units of logical extents. With the - sign the value will be subtracted from the logical volume's actual size and without it the value will be taken as an absolute size. The number can also be expressed as a percentage of the total space in the Volume Group with the suffix %VG, relative to the existing size of the Logical Volume with the suffix %LV, as a percentage of the remaining free space in the Volume Group with the suffix %FREE, or (for a snapshot) as a percentage of the total space in the Origin Logical Volume with the suffix %ORIGIN. The resulting value for the substraction is rounded downward, for the absolute size it is rounded upward. -L, --size [-]LogicalVolumeSize[bBsSkKmMgGtTpPeE] Reduce or set the logical volume size in units of megabytes. A size suffix of k for kilobyte, m for megabyte, g for gigabytes, t for terabytes, p for petabytes or e for exabytes is optional. With the - sign the value will be subtracted from the logical vol- ume's actual size and without it it will be taken as an absolute size. -n, --nofsck Do not perform fsck before resizing filesystem when filesystem requires it. You may need to use --force to proceed with this option. -r, --resizefs Resize underlying filesystem together with the logical volume using fsadm(8). EXAMPLES
Reduce the size of logical volume lvol1 in volume group vg00 by 3 logical extents: lvreduce -l -3 vg00/lvol1 SEE ALSO
fsadm(8), lvchange(8), lvconvert(8), lvcreate(8), lvextend(8), lvm(8), lvresize(8), vgreduce(8) Sistina Software UK LVM TOOLS 2.02.95(2) (2012-03-06) LVREDUCE(8)
All times are GMT -4. The time now is 07:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy