All Questions
124 questions
0
votes
0
answers
52
views
Command 'cdh' not found appearing at the top of CL when opened
I am new to Ubuntu, and I am using the latest version. Initially, I wanted to create an alias, using:
alias cdh='cd /home/[My name]/'
This was done since I wanted to download video files to a ...
2
votes
3
answers
143
views
can nohup and disown both still let program run after exiting the shell
I'm discovering the difference between nohup and disown in Ubuntu's bash.
I have while.py.
import time
while True:
print(1)
time.sleep(1)
First, I used ssh to connect to my ubuntu server and ...
0
votes
1
answer
94
views
systemd+ - cannot stop mongo service
I noticed mongo was listening on port 27017
I tried to stop it with:
$ sudo systemctl stop mongod Failed to stop mongod.service: Unit
mongod.service not loaded.
and then I did:
sudo service mongod ...
3
votes
2
answers
2k
views
find -name -path
I have a some tree.
.
├── 1
│ └── a
│ └── script.a.sh
├── 2
│ └── a
│ └── script.b.sh
...
└── a
└── script.sh
And I need to find script.*.sh. I execute ./a/script.sh:
#!/bin/bash
#...
0
votes
0
answers
385
views
NFS unable to mount server denied Access
On the server side (AIX)
vi /etc/exports
/NFS -rw
exportfs -a
On the client side, which is my laptop with ubuntu os.
showmount -e 192.168.119.56
Export list for 192.168.119.56:
/NFS (everyone)
While ...
1
vote
1
answer
1k
views
Grep from bash return No such file or directory but work if the same command executed manually from CLI
If i execute below bash script named test.sh, I receive this error:
./test.sh: line 8: grep -irl -e"1234567891" ./save: No such file or directory
If I execute the line above taken from ...
0
votes
0
answers
17
views
String formatting in bash script won't work [duplicate]
I am working on a self project which is an API server. I am trying to test my api routes using curl command with bash scripts.
The curl commands for post requests are pretty long so I want to use a ...
0
votes
0
answers
170
views
Stopping parameter expansion in write_file content of cloud-init userdata
Background
I'm using Terraform and cloud-init to provision an Ubuntu VM.
The Terraform template contains an embedded cloud-init user_data section that contains a write_file directive to write a bash ...
2
votes
1
answer
283
views
Using HOME variable in crontab result in broken jobs
I have this crontab file with a lot (100+) of jobs that execute some commands in the same directory, suppose ~/Documents/. Instead of cd ~/Documents/ && <command> for every jobs, I can ...
0
votes
3
answers
50
views
Iterate over a multiline variable and extract a particular line and use it as a command
The variable I wish to extract will look something like this
ttyACM0
ttyACM1
I would like to iterate over this variable and issue the command:
echo disconnect > /dev/ttyACM0
and then
echo ...
1
vote
1
answer
750
views
is there any way to limit number of clients (IPs) to connect a port ? (ubuntu 22)
I'm trying to find a way to limit the number of IPs that can connect to a certain port. here is a simple example that returns the number of unique IPs connected to a port
netstat -ntu | grep :80 | ...
1
vote
1
answer
54
views
How to compare 09 to 11
So I have a code that takes a part of a filename which is in date format and checks if that number is higher than 11.
All the files follow the same naming principal just with different names and dates....
2
votes
1
answer
424
views
How to split the content of a folder into subfolders
I would like to know if there is an easy way to automatically (programmatically, within a bash script) to split the content of a folder into subfolders with the parent folder.
I have a folder let's ...
4
votes
2
answers
12k
views
Creating a bash script to install packages
I'm quite a newbie when it comes to bash. I'm trying to create a script that checks whether a package is installed or not. If not it will install that package. Not sure what I'm doing tbh.
#! /bin/...
0
votes
1
answer
582
views
Ensure system accounts are non-login
I don't understand this egrep statement here. Why do we need to use -v "^\+" since the file starts with userid
egrep -v "^\+" /etc/passwd | awk -F: '($1!="root" &&...