Reputation
3,332
Top tag
Next privilege 5,000 Rep.
Approve tag wiki edits
Badges
1 6 21
Impact
~392k people reached

Apr
14
comment Sending mails from Linux
If you are running sendmail try echo "This is the message body" | mail -s "This is the subject" -r chhaya.vishwakarma@example.com chhaya.vishwakarma@example.com Then check sendmail -bp
Apr
13
comment Read files from directory and organize them by extentsion into corresponding folders
@letda, leave it out. You don't have to specify each file separately. The if [[ "${files[@]#*.}" == *jpg* ]]; .... will loop through the array and compare the extension. If the extension matches, then action is taken.
Apr
13
comment Read files from directory and organize them by extentsion into corresponding folders
Ok on top of my head for f in jpg mov; do files=(*."$f"); if [[ "${files[@]#*.}" == *jpg* ]]; then mv "${files[@]}" jpgdir/; else mv "${files[@]}" movies/; fi; done This should get you going. If you prefer to use switch you can do so. Try to understand this one liner and see if it fits your situation
Apr
6
comment How to search a log file in Linux and escape special characters like square brackets (i.e. [ and ])
Have you tried to use /ERROR \[section_NAME\]
Apr
6
comment SELinux crashed data system
You could try the same and use systemd.unit=emergency.target in the same line but this time don't include rd.break. Try to restore the SELinux context from there. Can you update your question and explain what you tried. Did it allow you to enter the grub menu? Did it responde to the commands I described above in my answer section?
Apr
6
comment SELinux crashed data system
Well the procedure above doesn't get you to mDNS/DNS-SD. It breaks in a very early stage of initramfs At this point nothing really is mounted or loaded.
Mar
31
comment Disabling USB automount in GNOME3
There is also a thread here: unix.stackexchange.com/questions/85061/…
Mar
31
comment Iterating over glob patterns, not the files in them
Wat is your input and desired output? I'm not sure if people can read minds.
Mar
31
comment awk - combine two filters into one
@Nahshonpaz df has the --output flag that can be very useful in such situations. e.g df -m / --output=avail |tail -n1 or if you want to use awk df -m / --output=avail |awk 'getline' And if you want to use purely bash syntax: read -d '' -ra df_arr < <(LC_ALL=C df -mP /); echo "${df_arr[10]}"
Mar
30
comment Why doesn't my bash terminal recognize any command in the shell?
@Benjamin It seems like your PATH variable is not set properly. Try to use absolute paths i.e /bin/ls /home/${USER} I
Mar
30
comment How to use crontab to shutdown linux for every saturday 3PM
@guido you probably meant 0 15 * * Sat shutdown -h now
Mar
22
comment Syntax error unexpected end of file
@L.Docherty this makes sure that the script looks at whatever shell is availiable on your path. It is more portable. If you are running a recent version of ubuntu or fedora or any other distribution, #!/bin/bash would work as well.
Mar
22
comment Syntax error unexpected end of file
@L.Docherty correct. Integers in usernames on *nix are allowed though but they may not start with an integer. E.g 12345 as a username is not allowed where abc1234 is allowed. You just run the script, test it a bit and modify it to your needs.
Mar
22
comment Syntax error unexpected end of file
I mean the user input. You never know if a user will put a _ or a ` ` <-- space etc. Anyways, you now should have a bit of an idea of what this script does.
Mar
22
comment Syntax error unexpected end of file
I have updated my answer. I haven't built any checking though, but that's left as exercise for the student! ;)
Mar
20
comment Bug in shell script for printing the tree-like structure of the curent diretcory
Did you know that there is a tree command ? Have you checked it?
Mar
19
comment for loop problem, detect file with size and copy regardless of name
You need an array list. Something like odtList=(*.odt); for f in "${odtList[@]}"; do myfunc "$f"; done would be closer to your solution
Mar
16
comment Network interface issue after upgrading CentOS 6 to 7
It seems that the kernel module / driver for your network card(s) is not loaded or available. Can you show the output of lspci |grep -i ether. Please provide more details like nmcli connection show as well.
Mar
16
comment Network interface issue after upgrading CentOS 6 to 7
Can you run dmesg | grep -i 'enp0s[38]' Also can you do a listing of /etc/sysconfig/network-scripts/
Mar
16
comment Network interface issue after upgrading CentOS 6 to 7
ifconfig is a depricated command and you should avoid using it. Use ip command instead. Also see if NetworkManager is running. Your interfaces might be renamed like enoXX where XX is the number of the PCIe slot on your machine/server.