All Questions
179 questions
3
votes
2
answers
697
views
How to limit the number of files printed by ls and print them in columns like ls prints normally?
Here is extension of the question: How do I limit the number of files printed by ls?
with additional condition: how to print results in as many columns as fit to the current terminal width — as ls ...
0
votes
1
answer
55
views
Is the idea of having a login shell and a non-login shell merely a way of making user preferences? [duplicate]
Scouring the internet about the difference between a login shell and a non-login shell, it turns out that the ultimate difference is merely the files that are being sourced. A login shell sources some ...
0
votes
3
answers
116
views
Play sound after command and also pipe output
I can easily pipe the output of a command like:
some_command | less
I can also easily play a sound after a command like:
echo test; print \\a
aplay, beep or others could also be used for sound.
...
1
vote
0
answers
102
views
Shell: Customizing the "Display all N possibilities? (y or n)" message
I already know that double-pressing the Tab key on Bash terminal will enlist all files and folders in the current working directory or, when appropriate, show Linux executables that I can run. I want ...
1
vote
0
answers
325
views
Bash terminal lagging one input behind
After a recent update, I've noticed that working on any terminal for more than a few minutes causes a delay between inputting a keypress and seeing it reflected on the screen.
Specifically, if I were ...
6
votes
1
answer
637
views
Order of shell expansions: command substitution versus arithmetic expansion
Consider the following snippet being entered at the command line in bash:
$ echo $(( $(wc -l letter.txt | cut -c1-4)/66 + 1))
Supposing letter.txt exists and has 66*4 lines, then this puts the string ...
1
vote
2
answers
5k
views
How to run the command "sudo sh /path/to/script.sh" by double clicking?
I have a question from this thread How to run a bash script by double clicking by entering the path in sudoers?. Since it was explained to me that it is unsafe to grant sudo privileges to the script....
0
votes
1
answer
181
views
Calling vim in subprocess after running cat
I am trying to create a bash function vim_run which operates as follows:
user pipes command output into vim_run
user can edit output
user exits vim and the contents of that buffer are now executed ...
-1
votes
1
answer
88
views
`IFS="value" command` is a popular feature of many shells, but official documentation is hard to find. Where is it documented officially? [duplicate]
I constantly see IFS="value" command being referred to as a means of changing the IFS (Internal Field Separator) temporarily, only for the duration of the command provided, yet there are ...
1
vote
1
answer
75
views
Separate variable scope spawning commands under job control
Is is possible in bash - or other sh-derivative shell - to run in the foreground from command-line a list of commands that have their own variable scope (so any values assigned to variables in that ...
4
votes
1
answer
2k
views
Shortcut to jump between words/phrases separated by spaces in a terminal
When we write commands especially long ones, we sometimes need to make edits. For example imagine:
docker run --rm --name My_container_3.19.2.9-999_khbdabshs --entrypoint bash registry.me.com:2001/...
6
votes
3
answers
1k
views
Add an item to a list of piped items
I need to add items to a list of items. I am not sure if these are the correct terms.
Example:
Suppose I am inside a directory with 2 files, "a" and "b". If I pipe ls to less my ...
1
vote
2
answers
6k
views
How can I create a hash or sha256sum in Bash using multiple sources or inputs? What is the recommended method?
I want to create a hash of more than one source in Bash.
I am aware that I can:
echo -n "STRING" | sha256sum
or
sha256sum [FILE]
What I need is:
STRING + FILE
FILE + FILE
STRING + STRING
...
2
votes
1
answer
455
views
notify-send with stderr in notification body if there is stderr
Suppose I have a command like:
foo() {
echo a
echo b >&2
echo c
echo d >&2
}
I use the following command to process stdout in terminal but send error via notify-send
foo ...
0
votes
1
answer
1k
views
How to make bash commands a specific color
I have my bash prompt on one line colored green with file path in blue. When I type a command it appears on the next line. After I press enter the output appears on the next line(s). Then there is an ...