list last few lines command


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers list last few lines command
# 1  
Old 08-18-2004
list last few lines command

Hi

If my ls -l results in 1000 lines and i just want to see the last few lines in the list what arguments do i pass


eg lets say i want to see only the last 5 lines of 'ls -l' result
# 2  
Old 08-18-2004
Pipe through "tail"

e.g.

ls -l | tail -5 (or ls -l | tail -n 5)

man tail

Cheers
ZB
# 3  
Old 08-18-2004
Personally, I like to pipe it through less +G. This way I can hit b to go up a few more lines if I need to.

ls -l | less +G
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Comparing lines within a word list

Hello all- New to this forum, and relatively new to using grep at the Terminal command line to work with regular expressions. I've got a background in math and some programming experience, so it's not been too difficult to learn the basics of searching through my word lists for particular types of... (13 Replies)
Discussion started by: dtalvacchio
13 Replies

2. Shell Programming and Scripting

Removing non-unique prefixed lines from a list

Not quite sure how to explain what I need to do (or how to title the post!) so will try and show it! Basically I have a list of 'modules' which takes the form seen below, where there can be a module name, module type and module version (a module may not have each of those and could in theory... (2 Replies)
Discussion started by: chrissycc
2 Replies

3. UNIX for Advanced & Expert Users

Need command for grepping pattern lines with subsequent lines

Hi, I have a requirement like, I have a list of pattens in a file say pattern.txt, PHC111 PHC113 and in another file called master.lst i have entries like, PHC111 a b PHC112 a PHC113 b c PHC114 d e (5 Replies)
Discussion started by: rbalaj16
5 Replies

4. UNIX for Dummies Questions & Answers

Appending lines from an existing list to each line in another existing list

Evening all ! I would like to ask your expertise on how to accomplish the following ; I have 2 lists, and would like each line from list2 to be appended to each line in list1, resulting in list3 ; List1; alpha beta charlie List2; one two three (4 Replies)
Discussion started by: TAPE
4 Replies

5. Shell Programming and Scripting

Removing lines from one list from another list.

Hello, I was wondering if there was an easy way to take lines from a single-column list, and remove them from a second single-column list. For example, I want to remove the contents of list 1 from list 2. How would I do this? Contents of list 1: server1a server2b server3c server4a... (2 Replies)
Discussion started by: LinuxRacr
2 Replies

6. UNIX for Dummies Questions & Answers

How to list file names instead of lines when grep a gzcat command?

Hi, I want to list filenames instead of lines when i search in compresed files for a string. #gzcat *.gz | grep -l 12345 gives me: <stdin> Anyone got a solution on this problem? (2 Replies)
Discussion started by: HugoH
2 Replies

7. UNIX for Advanced & Expert Users

fast way to retreive a list of lines

hi there, i have to read lines from the file, where the line is just above the pattern am looking for typically this looks like this <time-stamp>|----- <pattern am searching >...... <time-stamp>|..... <some garbage > .... the log file is big wc -l ~/log/ompe.log.20081203... (8 Replies)
Discussion started by: kiranreddy1215
8 Replies

8. Shell Programming and Scripting

awk/sed Command : Parse parameter file / send the lines to the ksh export command

Sorry for the duplicate thread this one is similar to the one in https://www.unix.com/shell-programming-scripting/88132-awk-sed-script-read-values-parameter-files.html#post302255121 Since there were no responses on the parent thread since it got resolved partially i thought to open the new... (4 Replies)
Discussion started by: rajan_san
4 Replies

9. UNIX for Dummies Questions & Answers

[bash]Stripping lines from a list

Hello! I have a script that is (among other things) doing the following: list=/tmp/list1.txt ncftpls -u <user> -p <password> -x "-l1" server.domain.tld > $list cat $list | nl echo "Choose file: " read file cat /tmp/list1.txt | nl | grep $file | sed -e "s/$file//g" -e "s/ //g" | column -t... (8 Replies)
Discussion started by: noratx
8 Replies

10. Shell Programming and Scripting

extract lines with a given list of identifiers

Hi All, My question is if the simple but powerful shell scripts can extract data from a big data file by using a list of identifier. I used to put everything in the database and do joining, which sounds stupid but only way I knew. For example, my data file looks like, ... (3 Replies)
Discussion started by: mskcc
3 Replies
Login or Register to Ask a Question