Help command
Author Message
Posted : Mon, 02 June 2008 21:30:29
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!
tophandcwby
Posted : Tue, 03 June 2008 18:09:39
Subject : Help command
One way $ ls -a1 | grep '^\..*' | tail -n 5
miklee
Posted : Tue, 03 June 2008 21:34:54
Subject : Re: Help command
[quote=tophandcwby]One way $ ls -a1 | grep '^\..*' | tail -n 5[/quote] Thank youuuuuu!! you are god!! :) how I can see the content of this 5 dir?
tophandcwby
Posted : Wed, 04 June 2008 14:26:41
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`
miklee
Posted : Wed, 04 June 2008 16:01:05
Subject : Re: Re: Re: Re: Re: Re: Help command
When I lunch this command: [b]on ubuntu:[/b] ubuntu@ubuntu:~$ ls `find . -maxdepth 1 -type d -print | grep '^\..*' | sort | tail -n 5` ./Pubblici: ./.pulse: ./.ssh: ./.update-notifier: ./Video: [b]on BT3:[/b] 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]
miklee
Posted : Wed, 04 June 2008 20:07:37
Subject : Help command
foud it! ls -a `ls -d .*/ | tail -n 5`
Johannes Truschnigg
Posted : Sun, 15 June 2008 19:29:21
Subject : Re: 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)