Linked Questions

81
votes
6answers
198k views

As root, how can I list the crontabs for all users?

I have a script being run automatically that I can't find in the crontab for the expected users, so I'd like to search all users' crontabs for it. Essentially I want to run a crontab -l for all users....
54
votes
9answers
81k views

How to change the volume name of a FAT32 filesystem?

I know I can set the volume name when I format the partition with the -n option of mkfs.vfat. But how to just change the name without formatting? I especially want to be able to use lower and ...
48
votes
10answers
81k views

How can I tell GRUB I want to reboot into Windows—before I reboot?

I have a dual boot Linux/windows system set up, and frequently switch from one to the other. I was thinking if I could add a menu item in one of the menus to reboot directly into windows, without ...
32
votes
3answers
14k views

Do functions run as subprocesses in Bash?

In Advanced Bash-Scripting Guide, in example 27-4, 7-th line from the bottom, I've read this: A function runs as a sub-process. I did a test in Bash, and it seems that the above statement is wrong....
22
votes
2answers
2k views

The old ticks vs parentheses issue: confused

Since being corrected many years ago, I switched from backticks to $() for command expansion. But I still prefer the backticks. It is fewer keystrokes and does not involve the Shift key. I understand ...
23
votes
3answers
30k views

What is $() in a command?

What is $() in Linux Shell Commands? For example: chmod 777 $(pwd)
17
votes
3answers
12k views

How can I work with binary in bash, to copy bytes verbatim without any conversion?

I am ambitiously trying to translate a c++ code into bash for a myriad of reasons. This code reads and manipulates a file type specific to my sub-field that is written and structured completely in ...
19
votes
5answers
20k views

How to execute a script located in the same directory as the current script?

Why are shell scripts are so hard to develop? In NodeJS I could simply do: require('./script') and it will always require script relative to the current script. But if I try that in shell/bash: ./...
10
votes
3answers
3k views

How to check if stdin is /dev/null from the shell?

On Linux, is there a way for a shell script to check if its standard input is redirected from the null device (1, 3) *, ideally without reading anything? The expected behavior would be: ./...
6
votes
4answers
46k views

Current time/date as a variable in BASH and stopping a program with a script

I am trying to create a raspberry pi spy cam bug. I am trying to make it so the new file created for the various processes come up with NOW=`date '+%F_%H:%M:%S'`; which works fine. but it requires ...
6
votes
1answer
2k views

I don't understand what a single backtick and double quote and >> do in this script

This example was in a Linux book: $ cat sort-wc #!/bin/bash # Sort files according to their line count for f do echo `wc -l <"$f» lines in $f done | sort -n $ ./sort-wc /etc/passwd /ect/fstab /...
7
votes
3answers
29k views

How to restart ssh-agent without relogin

I accidentally killed my ssh-agent, how do I restart it without having to reconnect ? I tried this but it does not work : $ eval $(ssh-agent -s) Agent pid 8055 Then, I open a new Gnome terminal ...
6
votes
4answers
56k views

How to create a user with given password on SuSE from command line?

I need to create bunch of new users with given password. What I want is a script that I would pass the user name of new user and it will create/add the user and set its password. (the password is the ...
1
vote
3answers
39k views

How to create user and password in one script for 100+ users

I have written a script for adding and setting password for 100+ users. Eg: for setting password of the user I want to set in "user+123" format for all the users I.e user will change according to the ...
4
votes
3answers
5k views

awk in ssh command line complains 'unexpected newline or end of string' How to resolve?

While running the below script had an issue, ^ unexpected newline or end of string How could I resolve this ? [root@emrbldbgdapd2 ~]# ./collectdata.sh collect the data of 10.209.61.124 awk: cmd. ...

15 30 50 per page