LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-16-2009, 03:05 AM   #1
prasanthp
LQ Newbie
 
Registered: Mar 2009
Posts: 21

Rep: Reputation: 15
What is Command to know the last mounted device.


Can any body please tell me what is the command in linux to know the last mounted device.
 
Old 06-16-2009, 03:32 AM   #2
Dinithion
Member
 
Registered: Oct 2007
Location: Norway
Distribution: Slackware 14.1
Posts: 446

Rep: Reputation: 59
I'm not quite sure, as I've never thought about it. But when I think about it it seems consistent that they are added to chronological to /etc/mtab. So you believe you should be able to retrieve it like this:

tail -n 1 /etc/mtab
or
mount | tail -n 1

If you want the mount point, you could change them to something like this:

tail -n 1 /etc/mtab | cut -d ' ' -f 2
or
mount | tail -n 1 | cut -d ' ' -f 2

To filter out the mountpoint. If you want the device, change the cut field accordingly (the -f option). Does this seem to work for you?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Permissions to mounted device Catapult Linux - Newbie 4 12-19-2008 08:29 AM
where to look out for my mounted device? sagsriv Linux - Newbie 2 05-25-2008 02:12 PM
testing if device is already mounted kushalkoolwal Programming 7 09-30-2005 12:40 PM
swap device not getting mounted jacobselvin Linux - Newbie 9 07-20-2005 10:48 AM
Access on mounted device!? mindspin Fedora 1 12-18-2004 07:47 AM


All times are GMT -5. The time now is 01:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration