Reputation
2,777
Top tag
Next privilege 3,000 Rep.
Cast close and reopen votes
Badges
4 18
Newest
 Student
Impact
~145k people reached

Apr
30
comment IP address of the username who uses sftp connection in unix
using w -f should show you what protocol is being used and what is being accessed.
Apr
29
comment How to use md5sum for checksum with an md5 file which doesn't contain the filename
cmp test.txt.md5 <(md5sum test.txt | awk '{print $1}') && echo $? If the result returned is 0 then there is a match
Apr
29
comment kill: SIGSTOP: invalid signal specification error in bash script
Well ok, I didn't notice the -SIGSTOP I thought passing -s to kill was mandatory. Thanks for the explaination! Learnt something new today.
Apr
29
comment kill: SIGSTOP: invalid signal specification error in bash script
As I explained in my edited answer. set +o posix will allow the usage of SIGTERM, SIGSTOP etc. I do agree that set -o posix at the end is not necessary. It's more a habit. I'm not sure what the significance or the added value is in your answer.
Apr
29
comment kill: SIGSTOP: invalid signal specification error in bash script
Well according to posix specs, there is no SIG in sh. So again instead of commenting on every answer I post you better edit the answer and provide the right one. How's that?
Apr
29
comment kill: SIGSTOP: invalid signal specification error in bash script
@user4757345 if that solved your problem, just modify the answer and add the explanation.
Apr
29
comment kill: SIGSTOP: invalid signal specification error in bash script
I see. Well probably because you need to enable posix mode? Are you on a Mac? set +o posix; kill -SIGSTOP 1234 could solve the problem as well!
Apr
29
comment kill: SIGSTOP: invalid signal specification error in bash script
Does the answer I posted illustrate the scenario? Do you still get the error? It should work interactively and as well as within a script.
Apr
29
comment kill: SIGSTOP: invalid signal specification error in bash script
You can use e.g trap 'kill -s SIGSTOP 1234' EXIT in a bash script. Also it is #!/bin/bash
Apr
29
comment Command to print users that don't have /sbin/nologin as a shell
@RomeoNinov Again, parsing ls output is not recommended. ls -l will also show the total bytes as the first field. Then the OP asks about files only and not folders,subfolders or files found in subfolders. Why you shouldn't parse ls output is explained here: mywiki.wooledge.org/ParsingLs
Apr
28
comment Command to print users that don't have /sbin/nologin as a shell
@RomeoNinov find might be an overkill but it is very accurate in checking directories. Parsing ls output is in general not Recommended.
Apr
28
comment bashrc lazy substitution
awk has a pattern space as well awk '/^Revision/{ print ...}' So no need for grep in this case.
Apr
28
comment mdoc warning: Empty input line #xx
What system are you running this command. Is this some *BSD system?
Apr
28
comment mdoc warning: Empty input line #xx
How are you searching man pages using grep?
Apr
26
comment dash: parse string into two variables
Oh my mistake. I didn't check that! Now I learned something! THanks
Apr
26
comment dash: parse string into two variables
echo doesn't survive the pipe. You can use Process Substitution to achieve what you want: E.g read -r X Y < <(echo "foo:123" | tr ':' ' '); echo "$X"
Apr
25
comment Longest/shortest Username in linux
Longest: awk 'length > longest_username { longest_username = length; longest=$0} END { print longest}' /etc/group Shortest: awk 'NR == 1 || length < length(shortest) { shortest = $0 } END { print shortest }' /etc/group
Apr
25
comment Formatting grep output with awk. Simple case and background case
@the_candyman there is no bash code in your example. You are using external commands player , grep , awk. You have problems with buffering. This page will explain everything about it: mywiki.wooledge.org/BashFAQ/009?highlight=%28unbuffer%29
Apr
25
comment Formatting grep output with awk. Simple case and background case
@G-Man why is the print wrong? And to solve his particular problem and if I had to remain in his way of thinking e.g mplayer *.* 2>/dev/null | stdbuf -oL grep "Playing" |awk '{print "Playing: " $0}' would do what he wants.
Apr
25
comment Formatting grep output with awk. Simple case and background case
What you need is mplayer Playing* 2>/dev/null | awk '/Playing/{print "Playing: " $0}' and you're done