Sponsored Content
Operating Systems Solaris using ls -ltr : display only last four file names Post 302401275 by rahulbahulekar on Friday 5th of March 2010 10:49:57 AM
Old 03-05-2010
using ls -ltr : display only last four file names

Hi ,

Server details –

Machine hardware: sun4u
OS version: 5.9
Processor type: sparc
Hardware: SUNW,Sun-Fire-880

When I put ls –ltr command I get –

Code:
/users/testuser> ls -ltr
-rw-rw-r--   1 testuser  dba           76 Jan 13  2009 ftp.scr
-rwxr-xr-x   1 testuser  dba         1436 Jan 13  2009 menudb_qa
-rw-rw-r--   1 testuser  dba           16 Jan 26  2009 test.dat20090126
-rw-rw-r--   1 testuser  dba          112 Mar 10  2009 exp_vaucc2.log
drwxrwxr-x   3 testuser  dba         1024 Mar 24  2009 data
drwxrwxr-x   2 testuser  dba           80 Aug 18  2009 tmp_dblogs
-rw-rw-r--   1 testuser  dba          189 Sep  9 05:21 test.txt
-rw-rw-r--   1 testuser  dba          149 Sep  9 05:22 t.txt
-rw-rw-r--   1 testuser  dba           77 Dec 31 07:46 afiedt.buf

But want the command to display only last 4 file names –

Expected result –

Code:
/users/testuser> 
drwxrwxr-x   2 testuser  dba           80 Aug 18  2009 tmp_dblogs
-rw-rw-r--   1 testuser  dba          189 Sep  9 05:21 test.txt
-rw-rw-r--   1 testuser  dba          149 Sep  9 05:22 t.txt
-rw-rw-r--   1 testuser  dba           77 Dec 31 07:46 afiedt.buf

Plz help.

Last edited by radoulov; 03-05-2010 at 11:56 AM.. Reason: Use code tags, please!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Display file names that are being deleted

The print command lists the path of the file being found. I want the output as the file name along with the date that particular files were created i.e similar to a ls -l command. I am using find to list all the files that satisfy the selection criteria and delete them using rm. Can I display... (2 Replies)
Discussion started by: theguy16
2 Replies

2. UNIX for Dummies Questions & Answers

Extracting only file size of the ls -ltr command.

All, I only need to get the file size when I do an ls -ltr filename.txt Could you give me the exact syntax. Thanks KOP (6 Replies)
Discussion started by: kingofprussia
6 Replies

3. UNIX and Linux Applications

display only file names

Hi, I want to display only the file names of the ls command with a delimiter of comma. For example:- ls /etc/dir/N* gives the following output /etc/dir/N1 /etc/dir/N2 /etc/dir/N3 I want the output as N1,N2,N3,-->Here i need the final comma also. Also, here /etc/dir is being... (4 Replies)
Discussion started by: dnat
4 Replies

4. Shell Programming and Scripting

Shell Script to display function names (called & defined) in a C++ Source Code

Hello to all, I am looking for a way to display only the names of function (calls & definition) of a C++ source code.There is already a post related to this, but the script is to find the functions using a specific variable, and the replies are not that convincing since they cannot be used for... (2 Replies)
Discussion started by: frozensmilz
2 Replies

5. Shell Programming and Scripting

Searching for file names in a directory while ignoring certain file names

Sun Solaris Unix Question Haven't been able to find any solution for this situation. Let's just say the file names listed below exist in a directory. I want the find command to find all files in this directory but at the same time I want to eliminate certain file names or files with certain... (2 Replies)
Discussion started by: 2reperry
2 Replies

6. UNIX for Dummies Questions & Answers

ls -ltr for a future date/time stamp file

Hi When i do ls -ltr <file1> then it shows me the date and time of the file if - for whatever reason file has future date/time stamp then ls -ltr is not showing the time, it just shows only date part ... even if time is ahead by 2 hr than current time. suppose a file was copied from INDIA... (3 Replies)
Discussion started by: reldb
3 Replies

7. UNIX for Advanced & Expert Users

ls -ltr a list of filenames-with-spaces within a text file

OS: RHEL 5.8 shell: bash 3.2.25 Directory /home/guest/ contains these files: file a file b file c fileD fileE fileF testFile.txt I'm trying to find the syntax to run ls -ltr against this list of files that is contained within a text file, testFile.txt. The file testFile.txt has... (4 Replies)
Discussion started by: uschaafm
4 Replies

8. Shell Programming and Scripting

Exclude certain file names while selectingData files coming in different names in a file name called

Data files coming in different names in a file name called process.txt. 1. shipments_yyyymmdd.gz 2 Order_yyyymmdd.gz 3. Invoice_yyyymmdd.gz 4. globalorder_yyyymmdd.gz The process needs to discard all the below files and only process two of the 4 file names available ... (1 Reply)
Discussion started by: dsravanam
1 Replies

9. Shell Programming and Scripting

I have two commands “ls -h” and “ls -ltr”. How do i make sure “ls -ltr” is run after “ls -h” is suc

help me (2 Replies)
Discussion started by: sonu pandey
2 Replies

10. UNIX for Beginners Questions & Answers

Generic script to load file details(ls -ltr) in to a database.

All, I am trying to create a report on the duration of an ETL load from the file arrival to the final dump in to a database for SLA's. Does anyone have any guidance or ideas on how metadata can be extracted; information of a file: like file name, created timestamp, count of records and load... (1 Reply)
Discussion started by: pradeepp
1 Replies
set_color(1)							       fish							      set_color(1)

NAME
set_color - set_color - set the terminal color set_color - set the terminal color Synopsis set_color [-v --version] [-h --help] [-b --background COLOR] [COLOR] Description Change the foreground and/or background color of the terminal. COLOR is one of black, red, green, brown, yellow, blue, magenta, purple, cyan, white and normal. o -b, --background Set the background color o -c, --print-colors Prints a list of all valid color names o -h, --help Display help message and exit o -o, --bold Set bold or extra bright mode o -u, --underline Set underlined mode o -v, --version Display version and exit Calling set_color normal will set the terminal color to whatever is the default color of the terminal. Some terminals use the --bold escape sequence to switch to a brighter color set. On such terminals, set_color white will result in a grey font color, while set_color --bold white will result in a white font color. Not all terminal emulators support all these features. This is not a bug in set_color but a missing feature in the terminal emulator. set_color uses the terminfo database to look up how to change terminal colors on whatever terminal is in use. Some systems have old and incomplete terminfo databases, and may lack color information for terminals that support it. Download and install the latest version of ncurses and recompile fish against it in order to fix this issue. Version 1.23.1 Sun Jan 8 2012 set_color(1)
All times are GMT -4. The time now is 09:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy