Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: shell tricks (Re: bash if file exists)



 There are tons of classic stories from the old days of Unix 
where filesystem corruption left the machine in a state 
where it would be unable to boot, and rebooting would 
make it necessary to wipe the hard drives and reinstall the 
entire system from the original installation tapes. This 
would have left a critical production system unavailable 
for days. 

In at least one of these stories, one of the sysadmins still 
had a root shell within Emacs on an X11 terminal, and was 
able to copy and paste the identical binaries from another 
server, and get the system back to a state where it was 
able to restore from backups, and the total downtime 
was only a couple hours. 

Without features like the builtin echo, it wouldn't have 
been possible to fix the system, and they would have had 
to reboot and then reinstall. 



Ben Holland wrote: 
> Just as a quick question and i'm not trying to be a dick about it, but if 
> you have a major file system corruption, why would the ability to know what 
> files are there be important. I really do ask this question in earnest, and 
> more to the point even, if the file system is hosed, and you can still 
> though the luck of the gods read the inode table how would the actual files 
> themselves not be corrupted. I mean, i'm kinda assuming that you picked this 
> info up because you had to, i'm just wondering about the circumstances. 
> 
> 2008/4/3 Derek Martin <[hidden email]>: 
> 
>   
>> On Thu, Apr 03, 2008 at 06:26:38PM -0400, Derek Martin wrote: 
>>     
>>> foo=`echo *.zip |grep -v '*\.zip'` 
>>>       
>> Incidentally, in this way, echo can be used like ls: 
>> 
>>  $ echo * 
>> 
>> Why is this useful to know?  Say your system has severe filesystem 
>> corruption, and /bin/ls is one of the files that was corrupted.  In 
>> general, if that happens, ls will not work, but if your shell still 
>> works, you can still get a list of the files in the directory with 
>> that command.  If you want to also see "hidden" files, then this: 
>> 
>>  $ echo * .[A-Za-z0-9]* 
>> 
>> Of course, that assumes Roman alphanumeric characters.  It doesn't 
>> work very well if you have files called things like  .���ö�ë in the 
>> directory.  =8^) 
>> 
>> 
>> -- 
>> Derek D. Martin    http://www.pizzashack.org/   GPG Key ID: 0xDFBEAD02 
>> -=-=-=-=- 
>> This message is posted from an invalid address.  Replying to it will 
>> result in 
>> undeliverable mail due to spam prevention.  Sorry for the inconvenience. 
>> 
>> 
>> _______________________________________________ 
>> Discuss mailing list 
>> [hidden email] 
>> http://lists.blu.org/mailman/listinfo/discuss
>> 
>> 
>>     
> 
>   
> ------------------------------------------------------------------------ 
> 
> _______________________________________________ 
> Discuss mailing list 
> [hidden email] 
> http://lists.blu.org/mailman/listinfo/discuss
>   


BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org