All Questions
69
questions
206
votes
11
answers
41k
views
I accidentally typed password into bash command line
I accidentally typed my password into bash command line, mistaking the Last login: ... line for Wrong password (I was in a hurry). What do I do to cover my trace?
What I did was editing .bash_history ...
46
votes
7
answers
138k
views
How to automatically run commands on SSH login?
Whenever I login to my Linux server I'd like to have several commands run automatically (set some variables, change location, etc.)
This needs to be done on user login, not on system start.
How can ...
21
votes
5
answers
25k
views
Execute a command if Linux is idle for 5 minutes
I would like to execute a command such as
notify-send 'a'
if my Linux machine has been idle for 5 minutes.
By idle, I mean the same thing a screen saver that gets activated would use to define "...
20
votes
3
answers
36k
views
how to stop cp: overwrite './xxx' ? prompt
How can I stop the cp command from prompting to overwrite. I want to overwrite all the files with out having to keep going back to the terminal. As these are large files and take some time to complete....
7
votes
4
answers
3k
views
How to empty the contents of continuosly streaming file in linux
i have the program running using this command
command 2> sample.txt
now that file is growing continuously and command will exit in 5-6 days and i beleive that file size won't go in GB
I tried ...
5
votes
1
answer
10k
views
Whitelisting commands a user can use with sudo
I've been attempting to set up a whitelist of commands a user can run on my system. The server I'm using is running CentOS 7. What is the syntax that should be used to only allow a certain group of ...
4
votes
1
answer
651
views
What does chmod 7760 <directory> do in CentOS 7 bash?
I typed the command chmod 7760 by accident. I meant to type chmod 770 and now I'm curious what the first command did exactly.
After typing chmod 7760 , I typed ls -Al and the directory name was ...
4
votes
2
answers
4k
views
bash script.sh vs ./script.sh vs #shebang
Assuming i am in a bash shell now and i execute the following
[me@server]$ bash script.sh
q1) Is a new child bash process created to execute the script ?
If i do a
[me@server]$ ./script.sh
q2) ...
3
votes
2
answers
9k
views
Redirect stdout to a file when process is run in background
How can I redirect the stdout of a program to a file when it's run in the background?
I have a program that generates output every second. When I run it normally and redirect to a file, the output ...
2
votes
2
answers
2k
views
Why there is difference between output of linux command du and ls?
I have a file in linux machine whose size is 3404494030 upon doing "ls -l". When I do "ls -lh" it shows 3.2 GB which is correct when converted from bytes to Gigabytes. But when I do "du -h" for the ...
2
votes
1
answer
2k
views
Prompt for values until press ENTER key with empty value
I'm working in a bash script for automatize some tasks. This is what I have done until now:
#!/usr/bin/env bash
PS3='Please enter your choice: '
options=("Create new group" "Add users to group" "...
2
votes
5
answers
2k
views
why do I need the "sudo" in this particular command?
sudo yum install automake libtool flex bison pkgconfig gcc-c++
boost-devel libevent-devel zlib-devel python-devel ruby-devel
for installing required packages for Thrift on CentOS 5..
is it ...
2
votes
1
answer
2k
views
Bash Script Exits su or ssh Session Rather than Script
I am using CentOS 5.4. I created a bash script that does some checking before running any commands. If the check fails, it will simply exit 0. The problem I am having is that on our server, the ...
2
votes
1
answer
13k
views
linux shell installing packages automaticc
I want to install packages automatically by running a script
I can write
yum install php
but I want it to install another package once installation of the php package is completed
Is there any ...
2
votes
3
answers
2k
views
Execute a command after sudo
The Background
I am working in a CentOS environment with numerous CentOS machines. Currently there are multiple developers that each have their own login/home directory and then for various admin ...