0
votes
1answer
43 views

Move numbers in a filename to the start

I have several files in a folder, with names in the form: SOMETEXT1 number SOMETEXT2.mp3, or SOMETEXT number.mp3. I want to rename these to number SOMETEXT SOMETEXT2.mp3, or number SOMETEXT.mp3. Using ...
1
vote
3answers
129 views

Permanently set `find` regextype

GNU find allows the use of different regex formats via the -regextype option, but as far as I can tell I have to type out -regextype <whatever> every single time which is onerous. If one wants ...
0
votes
2answers
189 views

Copy file names to another folder

I need to copy file names from one folder to another. File contents are never changed. No files are overwritten, moved or copied. It's only about file names. I have a folder A with files named: ...
18
votes
3answers
1k views

Why does the output of some Linux programs go to neither STDOUT nor STDERR?

Why does the output of some Linux programs go to neither STDOUT nor STDERR? Actually, I want to know how to reliably capture all program output, no matter what 'stream' it uses. The problem I have is ...
1
vote
1answer
40 views

Viewing the ASCII codes of piped-in characters

Is there a command that would let me see ASCII values of characters outputted from a program? Say I pipe in a NUL character and a p, could I get a 0 and a 112 out?
9
votes
2answers
6k views

bash get home dir by username

I want to obtain home dir of any user with echo echo ~puchuu >> /home/puchuu But I cant use variable echo ~$USER >> ~puchuu echo `echo ~$USER` >> ~puchuu
1
vote
1answer
583 views

save bash history, regularly

I have bash set up to save history, to a file. It does this whenever bash exits [properly]. As sometimes bash does not exit properly the history is lost. So the question is can I set up bash to save ...
8
votes
4answers
659 views

Unix tools: what if a file is named minus something?

I'm always wondering: most GNU/Unix tools take options in the form "minus something", sometimes followed by an argument. What if you got a file named minus something? $ ls -f $ rm -f $ ls -f $ mv -f ...
3
votes
1answer
407 views

sort by word length in Nth column

I've got a column file like this: 1 1 1 AKSDFJADFKASDJFAK 2 1 1 ADKLCJASDLKCJDLACKADCJLKDACJADS 3 1 2 AKLJDFHALKDJFHLKJSDKSDFHAKJFDHAKFHJAKFJ And I would like to sort the entries by the fourth ...