Hello!
After
yesterday's post about replacing the regular ls with other regular (or not so) utilities, I just could not get past the comments, especially considering that the post soared to the top of the charts and in 18 days it was read by 18k, with a tail of a man. Khabrovsk citizens have given the world many new ways to get rid of ls. I checked them all (but this is not accurate), combed some of them so that they corresponded to the conditions of the problem, and I want to share with you. Enjoy it!
1. dir
Yes, damn it. She completely flew out of my head. And although it is completely different than in DOS, Windows, and even in OS / 2, it performs its functions properly!
Eumorozov and
cru5ader reminded me of her
dir -aA ~
2. printf
I repent. zsh spoiled me and I thought print was such a utility - a light version of echo, but it turned out to be just the giblets of zsh itself. But
iig showed a master class using printf
printf "%s\n" ~/* ~/.*
3. echo
Yes, it's him again ... working through automatic autocompletion. Thank
you for this
SlavniyTeo echo -e 'echo \t\ty\b\b\b\b\b\b\b' | bash -i echo -e 'echo \t\ty\b\b\b\b\b\b\b' | sh -i
But zsh users are out of luck, although maybe if you configure it?
3. vim
cru5ader recalled that vim has its own file browser, and since vim is everywhere (well, almost. There is a regular vi on the manjaro and this focus will not work with it) then why not use it?
vim ~
4. rm
Yes! Your eyes do not deceive you. What is the basis of the famous
Barmin patch , which scares beginner unixoids, we will use exclusively for peaceful purposes. Thanks
POPSuL yes "n" | rm -i $HOME/* $HOME/.* 2>&1|grep -o "$HOME[^']*"
And
cheater (echo y; yes n) | rm -ir ~ 2>&1 | sed -E -e "s/(rm:[^']+)|\?//g"
5. rsync
But actually, why not? Thank you for this
027 rsync --list-only ~/
6. grep
With a grep, you can not only check e-mail for validity, but also extract files.
kashtan404 and
KorDen32 showed that this is within his power (fixed on a more correct option).
grep -l '.*' ~/* ~/.* 2>/dev/null || grep -L '.*' ~/* ~/.* 2>/dev/null
7. file
Want to understand what kind of files are in your hamster? Or maybe just list them out?
027 and
POPSuL proved that he could do it.
file ~/* ~/.*
8. stat
File or entire file system status? Not only! There are at least three ways to cook a stat. One even from me.
stat ~/* ~/.*|grep "/home"|awk '{print $2}'
Other by
polar_yogi stat -c "%A %G:%U %s %x %n" * \.*
And the third from
iig stat *|awk '/File:/{print $2}'
9. head
Artyushov - the head! Showed how to use head!
head -n 0 -v ~/* ~/.*|awk '{print $2}'
10. getfacl
The key letter in the name of this utility is “f” and
Zoro has proven it!
getfacl ~/* ~/.* | grep "# file" | awk '{print $3}'
11. git
Yes, even Git comrade
tork made me work for a hamster!
git init ~/ ; curr=`pwd`; cd ~ ; git status; rm -rf .git; cd $curr ; curr=''
12. cat
Everyone loves cats. But the coolest users of BSD systems! Unfortunately in Linux, cats are of the wrong breed. :-(
Uzix boasted of its cat.
cat ~ |strings |xargs -IX sh -c 'test -e X && echo X'
13. lsattr
lsattr is
not only a valuable tool for looking at file attributes, but also a list viewer for the files themselves.
Neveil showed how to do it.
lsattr ~/* ~/.* 2>&1 | grep -Po '/.*'
Epilogue
I’ll probably dwell on a damn dozen, but those who are interested can look into the comments of the original post and enjoy, because the “single-liners” in perl, ruby, python, php and even C ++ are left behind.