Sponsored Content
Full Discussion: Files by size
Top Forums UNIX for Beginners Questions & Answers Files by size Post 303019763 by wbport on Thursday 5th of July 2018 05:35:56 PM
Old 07-05-2018
This script (we call ours lz) has an optional "-r" first parameter for descending sizes and/or the star name(s) you would put after an ls command.
Code:
rev=""
if [ $# -gt 0 ]
  then
  if [ $1 = '-r' ]
  then
    rev="r"
    shift
  fi
fi
ls -l $* |grep -v "total " |sort +4n$rev -5 +8 |more -e

Same sized files are listed alphabetically.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

sort files by size

Is there a way to sort files by size using the ls command? thanks in advance (1 Reply)
Discussion started by: AMD
1 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

size of files

hello Experts,can any one tell me that i have a folder data in linux. and there are three files A,B,C in the directory. cany any one tell me the command that which can tell me how much space is occupied by each file and its free space also for example FILES USED SPACE FREE SPACE A ... (1 Reply)
Discussion started by: shary
1 Replies

4. Shell Programming and Scripting

This script cut size of files "Lol" change string in files

Basic: find . -type f -name “*.txt” -print | awk '{gsub("Ontem", "AntesdeOntem", $0); print > FILENAME}' *.txt The idea is in folder /home/myapontamentos I have some files and i need to change in all them the word "ontem" to "antesdeontem". But bigger files are cut (size i mean)... (4 Replies)
Discussion started by: single
4 Replies

5. Shell Programming and Scripting

Merge files of differrent size with one field common in both files using awk

hi, i am facing a problem in merging two files using awk, the problem is as stated below, file1: A|B|C|D|E|F|G|H|I|1 M|N|O|P|Q|R|S|T|U|2 AA|BB|CC|DD|EE|FF|GG|HH|II|1 .... .... .... file2 : 1|Mn|op|qr (2 Replies)
Discussion started by: shashi1982
2 Replies

6. UNIX for Dummies Questions & Answers

copy only new files or files of a different size

hello i would like to copy files from 1 location to a nother, but it has only to copy files which are newer or have a different filesize. all has to be logged to a copy.log file (als skipped files should be in the log) is this possible with the cp command (1 Reply)
Discussion started by: arnoldg
1 Replies

7. UNIX for Dummies Questions & Answers

How to list files which have same size?

Hi guys, I need to do 100 files comparison after I sorted the files. There are no specific key for sorting so i plan to arrange the files based on the file size. The command that i used to sort the files by size is as per below:- ls -l | sort +4rn | awk '{print $5, $9}' The problem that i... (3 Replies)
Discussion started by: shahril
3 Replies

8. Shell Programming and Scripting

How to delete some of the files in the directory, if the directory size limits the specified size

To find the whole size of a particular directory i use "du -sk /dirname".. but after finding the direcory's size how do i make conditions like if the size of the dir is more than 1 GB i hav to delete some of the files inside the dir (0 Replies)
Discussion started by: shaal89
0 Replies

9. Shell Programming and Scripting

Files have same size

Hello, I want remove files have same size in a directory. this command only find this files. ls -l | awk '$1!~/^d/{if(size!=""){ print}size=$8}' I want to remove the files of the same size. samples: 5 files are same size. I want to keep only first file. Thank you very much for your help. (3 Replies)
Discussion started by: hoo
3 Replies

10. UNIX for Advanced & Expert Users

Files by size

I am new to Unix and need help. I have several files of different sizes Example: 1 GB , 2GB , 500 mb ,200mb and even small sizes. What I want is I want to pick files and sum of the combined file size should be less than 3 Gb and move them to a different directory. when I do ls -ltr I want to pcik... (1 Reply)
Discussion started by: pyarigreat
1 Replies
GIT-NAME-REV(1)                                                     Git Manual                                                     GIT-NAME-REV(1)

NAME
git-name-rev - Find symbolic names for given revs SYNOPSIS
git name-rev [--tags] [--refs=<pattern>] ( --all | --stdin | <commit-ish>... ) DESCRIPTION
Finds symbolic names suitable for human digestion for revisions given in any format parsable by git rev-parse. OPTIONS
--tags Do not use branch names, but only tags to name the commits --refs=<pattern> Only use refs whose names match a given shell pattern. The pattern can be one of branch name, tag name or fully qualified ref name. If given multiple times, use refs whose names match any of the given shell patterns. Use --no-refs to clear any previous ref patterns given. --exclude=<pattern> Do not use any ref whose name matches a given shell pattern. The pattern can be one of branch name, tag name or fully qualified ref name. If given multiple times, a ref will be excluded when it matches any of the given patterns. When used together with --refs, a ref will be used as a match only when it matches at least one --refs pattern and does not match any --exclude patterns. Use --no-exclude to clear the list of exclude patterns. --all List all commits reachable from all refs --stdin Transform stdin by substituting all the 40-character SHA-1 hexes (say $hex) with "$hex ($rev_name)". When used with --name-only, substitute with "$rev_name", omitting $hex altogether. Intended for the scripter's use. --name-only Instead of printing both the SHA-1 and the name, print only the name. If given with --tags the usual tag prefix of "tags/" is also omitted from the name, matching the output of git-describe more closely. --no-undefined Die with error code != 0 when a reference is undefined, instead of printing undefined. --always Show uniquely abbreviated commit object as fallback. EXAMPLE
Given a commit, find out where it is relative to the local refs. Say somebody wrote you about that fantastic commit 33db5f4d9027a10e477ccf054b2c1ab94f74c85a. Of course, you look into the commit, but that only tells you what happened, but not the context. Enter git name-rev: % git name-rev 33db5f4d9027a10e477ccf054b2c1ab94f74c85a 33db5f4d9027a10e477ccf054b2c1ab94f74c85a tags/v0.99~940 Now you are wiser, because you know that it happened 940 revisions before v0.99. Another nice thing you can do is: % git log | git name-rev --stdin GIT
Part of the git(1) suite Git 2.17.1 10/05/2018 GIT-NAME-REV(1)
All times are GMT -4. The time now is 02:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy