Questions tagged [bash]
Bash is a free shell for Unix-like operating systems from the GNU Project.
11,779
questions
0
votes
2
answers
105
views
bash + how to insert date before line
lets say I want to pipe the date output in the beggining of some text
for example
echo "this line is test line" | date
and expected output should be
Wed May 22 14:55:10 UTC 2024 this line ...
1
vote
0
answers
97
views
how to install memcached via pecl?
I'm trying to install memcached and am having some difficulty. Here's what I tried:
apt-get update
apt-get install memcached libmemcached-dev libzip-dev
pecl install memcached
pecl install memcached ...
0
votes
1
answer
24
views
changing the directory a tarball decompresses to
When I do wget https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz and then tar xvzf install-tl-unx.tar.gz the files get extracted (right now) to install-tl-20240521. On the CLI it's ...
0
votes
0
answers
41
views
Store output of command history
Is there some way to record not only the commands that I type in my terminal, but also their ouput? Is there maybe something that I can add to my .bashrc that could act similar to passing all commands ...
1
vote
1
answer
209
views
How to find matching yaml files based on content
I have a bunch of files that contain yaml. Some files are yaml-only, some have yaml front-matter. I would like to be able to query the list of files to return a list that match certain criteria. In ...
0
votes
1
answer
138
views
ls -ltr on the terminal lists the files but says "No such file or directory" in a shell script
I am new to Bash and am practicing some shell scripts. I wanted to write a script to list all the folders and their file count, if a root path is passed as a parameter value from the terminal. The ...
0
votes
1
answer
33
views
SOX do not want name files
Want to record a radio broadcast into separated files.
receiver | sox -traw -r8k -es -b16 -c1 - -b16 -es -c1 -r48000 -t wav ~/myfolder/$(date +%H_%M_%S).wav silence 1 0.10 0.1% 1 1 0.1% : newfile : ...
1
vote
2
answers
44
views
Abstracting echo && return in Bash
In Bash I want to be able to write something like:
tst() {
[ -z "$1" ] && die "No parameters provided!"
# do whatever
}
but I cannot define die like this:
die() {
...
0
votes
0
answers
57
views
Connect to PEAP wifi network on mac with a shell script
I am making a shell script for my mac and part of it requires connecting to my school's wifi network.
I have tried both of the following commands and while the settings wifi tab says that the computer ...
0
votes
2
answers
80
views
File with no permission accessed with sudo
as no user have any permission to read file.txt,then why/how 'sudo cat file.txt' prints file contents?
bs01316@bs01316:~/test$ ls -l
total 4
---------- 1 bs01316 bs01316 6 মে 7 16:20 file.txt
...
0
votes
1
answer
71
views
How to do a Proximity text search, 2 + words?
What is a Linux terminal command to do a Proximity text search?
Search a directory, recursively, for files that contain :
2 words or more within
99 characters of each other
any order of above words.
...
0
votes
1
answer
78
views
Why executing 'bash' in the terminal opens wsl on Windows 10?
When I run the 'bash' command in the terminal, my console automatically switches to the 'wsl' mode. Why is this happening and how do I stop this behavior? It causes problems when I run other scripts, ...
1
vote
1
answer
54
views
git - using gitconfig to switch repository host address
So right now I have some alias in my ~/.ssh/config:
Host github_company_a
HostName github.com
Host github_company_b
HostName github.com
and I use the alias directly: git clone git@...
17
votes
2
answers
4k
views
How does ls know how to output its results?
While creating a bash script, I found that this code ls puts all files on one line:
pi@raspberrypi:~/ptlrestinterface$ ls
update.sh web.config MyApp.runtimeconfig.json
still ls | head -n1 ...
1
vote
0
answers
112
views
bash tab completion when using asterisk prefix for filename matching
I've noticed an undesired behavior with bash tab completion when it comes to filenames and I'm wondering if anyone knows of a fix. Say I have a directory with a bunch of files but only one with a ...