Linux.com

Author Message
Joined: Jun 02, 2008
Posts: 4
Other Topics
Posted Jun 02, 2008 at 9:30:29 PM
Subject: Help command

Hi boys, I have a problem to write a command:
write a command to show the content of the last 5 hidden directory in the home of the current user.

How can I do?
thank you so much!

Back to top Profile Email Website
tophandcwby
Joined Apr 10, 2008
Posts: 66

Other Topics
Posted: Jun 03, 2008 6:09:39 PM
Subject: Help command

One way
$ ls -a1 | grep '^\..*' | tail -n 5

Back to top Profile Email Website
miklee
Joined Jun 02, 2008
Posts: 4

Other Topics
Posted: Jun 03, 2008 9:34:54 PM
Subject: Help command

Quote tophandcwby:
One way
$ ls -a1 | grep '^\..*' | tail -n 5

Thank youuuuuu!! you are god!! :)

how I can see the content of this 5 dir?

Back to top Profile Email Website
tophandcwby
Joined Apr 10, 2008
Posts: 66

Other Topics
Posted: Jun 04, 2008 2:26:41 PM
Subject: Help command

The command I gave you only lists the last 5 files, not directories, I guess I should have read your question a little closer. Here is the answer to your second question.

$ ls `find . -maxdepth 1 -type d -print | grep '^\..*' | sort | tail -n 5`

Back to top Profile Email Website
miklee
Joined Jun 02, 2008
Posts: 4

Other Topics
Posted: Jun 04, 2008 4:01:05 PM
Subject: Help command

When I lunch this command:
on ubuntu:

ubuntu@ubuntu:~$ ls `find . -maxdepth 1 -type d -print | grep '^\..*' | sort | tail -n 5`
./Pubblici:

./.pulse:

./.ssh:

./.update-notifier:

./Video:

on BT3:

BT~# ls `find . -maxdepth 1 -type d -print | grep '^\..*' | sort | tail -n 5`
./.xchat2:
downloads/
ignore.conf
keybindings.conf
notify.conf
pevents.conf
servlist_.conf
sound.conf
urlhandlers.conf
xchat.conf

./.xmms:
Plugins/
Skins/
config
menurc
xmms.m3u

./.zenmap:
recent_scans.txt
scan_profile.usp
target_list.txt
zenmap.conf
zenmap.db
zenmap_version

./Desktop:
Home
System

./sample_scripts:
ping.py*
rpcdump.py*
samrdump.py*
sniff.py*
sniffer.py*
split.py*
tracer.py*


I have no hidden directory too


[Modified by: miklee on June 04, 2008 04:09 PM]

Back to top Profile Email Website
miklee
Joined Jun 02, 2008
Posts: 4

Other Topics
Posted: Jun 04, 2008 8:07:37 PM
Subject: Help command

foud it!
ls -a `ls -d .*/ | tail -n 5`

Back to top Profile Email Website
Johannes Truschnigg

Joined Jun 15, 2008
Posts: 27

Other Topics
Posted: Jun 15, 2008 7:29:21 PM
Subject: Help command

"Most correct" solution failing on Newline characters in directory names:

ls $(find . -maxdepth 1 -type d -a -name ".*" -print | sort -n | tail -n5)

Free software. Free society. Better lives.

Back to top Profile Email Website
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya