All for Joomla All for Webmasters

Auto Open New file created or recently changed | Linux Command


Command Line

$
abrir_recente(){ ls -1Art | tail -1 | xargs -I '{}' -s 10000 xdg-open
'{}'; }


steps

  • Initialize the function ‘abrir_recente’ with the following instructions.

  • The ‘ls’ command displays the files in the current directory in the single list format, reversing the order by file modification date; Causing the most recent file is displayed on the bottom line and ignores the implicit character. ” and ‘..’.

  • The ‘tail’ captures the last item in the list.

  • The ‘xargs’ transforms the file name ‘{}’ defining the character limit to 10,000 by name. Runs ‘xdg-open’ command that reads the MIME type of the file and calls the preferred application.

Command Output

Auto Open New file
Click on the image to enlarge.

 

NOTE: If the newest item is a directory, the xdg-open calls the current file manager. The list function files in the current directory.

Like it? Share with your friends!

0
, 0 points

Auto Open New file created or recently changed | Linux Command

log in

Become a part of our community!

reset password

Back to
log in
Choose A Format
Personality quiz
Trivia quiz
Poll
Story
List
Meme
Video
Audio
Image