Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to get the latest modified file name in /home directory? Post 302403310 by karthigayan on Friday 12th of March 2010 04:23:37 AM
Old 03-12-2010
In ls there in a option called -t .It will list based on the modified time .

Code:
ls -lrt

To get the recently modified file use the following,

Code:
ls -lrt | tail -n 2

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Copy the latest file from one directory to another

Hi All, I am in the directory a/b/processed the files in this directories are -rw-r--r-- 1 owb users 330 Aug 8 chandantest.txt_08082008 -rw-r--r-- 1 owb users 220 Aug 7 chandantest.txt_07082008 -rw-r--r-- 1 owb users 330 Aug 6... (3 Replies)
Discussion started by: chandancsc
3 Replies

2. Shell Programming and Scripting

How to find the latest modified file from the unix server.

hi Friends, In my directory i have some files. I need to find out latest modified file. Please help me. Sreenu. (2 Replies)
Discussion started by: sreenu80
2 Replies

3. UNIX for Advanced & Expert Users

how to open a last modified file in a directory

how to directly open a last modified file in a directory? Please help (5 Replies)
Discussion started by: apsprabhu
5 Replies

4. Shell Programming and Scripting

Move the latest or older File from one directory to another Directory

I Need help for one requirement, I want to move the latest/Older file in the folder to another file. File have the datetimestamp in postfix. Example: Source Directory : \a destination Directory : \a\b File1 : xy_MMDDYYYYHHMM.txt (xy_032120101456.txt) File2: xy_MMDDYYYYHHMM.txt... (1 Reply)
Discussion started by: pp_ayyanar
1 Replies

5. Shell Programming and Scripting

to pick the latest file modified in a directory

I wan to pick the latest modified file name and redirect it to a file .. ls -tr | tail -1 >file but this is printing file ins side the filename , can anyone help me out (5 Replies)
Discussion started by: vishwakar
5 Replies

6. Shell Programming and Scripting

Listing latest modified or created files recursively

Hi, I want to display latest files (created or modified) recursively in a path. I tried in different ways, but didn't get any desired output: find $path -type f -exec ls -lt {} \; | sort -n -r find $path -type f -printf %p";" | xargs -d ";" ls -t Second one is giving the error:... (21 Replies)
Discussion started by: karumudi7
21 Replies

7. Shell Programming and Scripting

Help with finding the latest modified version of a file within directories

I am trying to look into multiple directories and pluck out the latest version of a specific file, regardless of where it sits within the directory structure. Ex: The file is a .xls file and could have a depth within the directory of anywhere from 1-5 Working directory - Folder1... (6 Replies)
Discussion started by: co21ss
6 Replies

8. UNIX for Dummies Questions & Answers

To find the latest modified file in a directory

I am trying to fetch the latest modified file from a directory using the command find . -type f -exec ls -lt \{\} \+ | head | awk '{print $9}' After the O/P, I get the below mentioned error and the command doesnt terminate at all. find: ls terminated by signal 13 find: ls terminated by... (2 Replies)
Discussion started by: Sree10
2 Replies

9. UNIX for Beginners Questions & Answers

Modified or latest files copy from windows to Linux

To copy the file from windows to linux i use pscp command(pscp source user@destination). Know i want to copy the latest modified or created files from windows to linux. could any one please help me out with it. Thanks and Regards, Sourabh (2 Replies)
Discussion started by: SourabhChavan
2 Replies

10. UNIX for Beginners Questions & Answers

Need help with listing file name and modified date on a huge directory

hi, We have a huge directory that ha 5.1 Million files in it. We are trying to get the file name and modified timestamp of the most recent 3 years from this huge directory for a migration project. However, the ls command (background process) to list the file names and timestamp is running for... (2 Replies)
Discussion started by: subbu
2 Replies
mkpasswd(8)						      System Manager's Manual						       mkpasswd(8)

Name
       mkpasswd - generate hashed password table

Syntax
       /etc/mkpasswd [-uv] passwdfile

Description
       The command is used to generate the hashed password database used by the library routines and

       If  the -u option is present the hashed files will not be built unless they already exist.  In any case, the hashed files will not be built
       if the time of last modification of the passwdfile is less recent than that of an existing hashed files.

       If the -v option is supplied, each entry will be listed as it is added.

       The file passwdfile is usually and must be in the format of The command will generate  database	files  named  passwdfile.pag  and  passwd-
       file.dir.   The command will exit with a non-zero exit code if any errors are detected.	Otherwise it will print the number of entries pro-
       cessed and the length of the longest entry.

       The presence of the hashed files is optional. They are not required for correct operation of or but will improve their performance on  sys-
       tems with moderate to large sized files.

Diagnostics
       The data base is already up to date.
       If the specified file has been modified less recently than the hashed files.

       Database not created.
       When used with the -u option and the database does not already exist.

Files
       passwdfile.dir Database filename

       passwdfile.pag Database filename

See Also
       getpwent(3), passwd(5), vipw(8)

																       mkpasswd(8)
All times are GMT -4. The time now is 08:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy