Tag Info

New answers tagged

0

As I dont have enough reputation to write comments, I will rewrite the solution from mfisch in adding the answer for Lindh-E : SOLUTION : pm-utils provides a bunch of scripts that run on sleep/resume. What you need is to : Create a script called 99MyScript.sh (99 allows to run it after other scripts) Add your script in /usr/lib/pm-utils/sleep.d Assign ...


-1

Sorry if I wasted anyone's time. The answer is in Bash script with execution permissions won't run with dbl click -- which I found in Linked and Related. Thank you for UBUNTU.


-1

Try the below command, sudo chmod a+rw -R After this run, .rvm Then try to install ruby. Hope this helps.


0

Bash fancy menu Try it out first, then visit my page for detailed description ... No need for external libraries or programs like dialog or zenity ... #/bin/bash # by oToGamez # www.pro-toolz.net E='echo -e';e='echo -en';trap "R;exit" 2 ESC=$( $e "\e") TPUT(){ $e "\e[${1};${2}H";} CLEAR(){ $e "\ec";} CIVIS(){ $e "\e[?25l";} DRAW(){ $e ...


0

You need to create a desktop launcher for your program. It must have .desktop extension.Open a text editor first,write necessary lines and then save it with .desktop extension. For example tor.desktop [Desktop Entry] Version= version of the program(like 0.5,etc) Name=tor Comment=tor browser (any comment you wish) Exec=a path to the start command ...


1

They appear to be plug-ins rather than scripts - if so, they need to go into your gimp plug-ins directory e.g. unzip ~/Downloads/gimp_instagram_effects.zip -d ~/.gimp-2.8/plug-ins/ After that, they should be accessible via an Instagram filter group under the Filters menu.


1

You don't even have to use SIGTERM. tail listens for SIGINT and SIGQUIT too. I'm not sure if there's any difference between signals (it's all specific to tail) but any of these would be better than SIGKILL. It's quite easy to test too: $ tail -f /dev/null > /dev/null & [1] 26599 $ kill -SIGINT $! [1]+ Interrupt tail -f /dev/null > ...


1

SIGTERM sends a signal to the command and will tell the command to stop itself. If there is a need to clean-up files due to the kill the command can do that. SIGKILL sends a signal to the init system. The command itself does not get even told it is going to get killed. So you can use both; but SIGTERM should be preferred (it is more graceful). Will ...


1

best I could find on my own (and I'm a newbie) was just running 'apt-get check' for a clue as to how things turned out following an install. Also running 'script' prior to running an 'apt-get install' will capture all the output from the command to file so that you don't have to worry about it scrolling away.


1

Most commands that output data on stdout, (which includes grep and sed,) buffer their output when it's not going to a terminal. That is, they wait for a large chunk of output to gather (like 4KiB) before flushing the chunk to the file or pipe. This is generally more efficient. Some commands allow you to override this, like GNU grep which has a ...


0

You can use cron. cron allows you to set scheduled tasks in Linux. crontab -e @reboot <path-to-script>/boot-up #add to end of file


3

The script below is an opposite- variant of this script; while that one acts on specified drives, this scripts acts on all except specified (usb) drives. What it does Whenever an external usb storage device is being connected, the script copies its content into a directory, defined by you (in the head section of the script: target_folder =). A sub ...


0

You can do something like this: the_ppa=... # set appropriately if ! grep -q "$the_ppa" /etc/apt/sources.list /etc/apt/sources.list.d/*; then # commands to add the ppa ... fi Notes: grep exits with success if it finds a match The ! negates this, so the commands will be executed if there is no match = ppa not added The -q flag makes grep quiet, so ...


0

Removing list.save files, sources, ensure only deb lines and count it for "fogger" ppa: ppa_added=`grep ^ /etc/apt/sources.list /etc/apt/sources.list.d/* | grep -v list.save | grep -v deb-src | grep deb | grep fogger | wc -l` echo $ppa_added


1

dd out of /dev/urandom should get the job done. If you need more "purity" to the randomness, you can also use /dev/random. i.e. : mgodby@mgodby-nb1:~$ dd if=/dev/urandom of=/home/mgodby/blah.crap bs=4 count=3000000 3000000+0 records in 3000000+0 records out 12000000 bytes (12 MB) copied, 7.73399 s, 1.6 MB/s mgodby@mgodby-nb1:~$ Tune your "block size" ...


3

dd if=/dev/random of=~/student/john.bin bs=1024 count=12000 or dd if=/dev/urandom of~/student/john.bin bs=1024 count=12000 Where bs is the size of each random input you want (1024 = 1Kb), and count is how many of those blocks you want. ie. bs=1024, count=12000: 12MB bs=512, count=24000: 12MB bs=256, count=48000: 12MB etc.


1

You can use curl. Make a file that contains the following: #!/bin/bash curl -o target/path/filename URL Where target/path/filename is the folder you want to save it to /tmp and URL is your specified link. So #!/bin/bash curl -o /tmp/world.o http://example.com/your.file If curl is not installed, you can install it with sudo apt-get install curl.


1

Here are some oneliners..... Awk ifconfig eth0 | awk '/inet addr/{split($2,a,":"); print a[2]}' split function in the above awk command splits the second column based on the delimiter : and stores the splitted value into an associative array a. So a[2] holds the value of the second part. sed ifconfig eth0 | sed -n '/inet addr/s/.*inet addr: ...


0

I couldn't find the answer to my question (which would be convenient), but instead coded up a Python GUI with a slider. I made two versions, one with wxPython and one with Tk. https://gist.github.com/nmz787/ff7ae7b64d59070390ea


1

For the sake of providing another option, you could use the ip addr command this way to get the IP address: ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1 ip addr show eth0 shows information about eth0 grep "inet\b" only shows the line that has the IPv4 address (if you wanted the IPv6 address, change it to "inet6\b") awk '{print $2}' ...


-1

#!/bin/bash while : do if [ $(ps -e | grep "exe" | wc -l) -eq 0 ] then if [ $(find *.gjf | wc -l) -gt 0 ] then d09 'find *.gjf | head -n 1` else brake fi sleep 60 fi done exit This script worked for me :P


4

save this in a file and then run bash <filename> #!/bin/bash ifconfig eth0 | grep "inet addr" being more accurate to get only number showing IP address: #!/bin/bash ifconfig eth0 | grep "inet addr" | cut -d ':' -f 2 | cut -d ' ' -f 1


1

As indicated by other answers, the result depends on whether anacron is installed. On a desktop, it is installed by default, BUT crucially it is not installed in the server distribution. So the answer is around 06:25 on a server and about 07:35 on a desktop.


1

Use find instead: find /some/path -name '*~' -type f -delete -name '*~' for filenames ending in ~ -type f for regular files (skipping directories, etc.) -delete ... well?


0

Never mind I found out the answer, there was carriage returns and an ^M char which I had never seen. This question can be deleted.


0

Using sed: sed -r 's/([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3})/\4.\3.\2.\1/' Match IP address and print from last to first(reverse)


0

Here is a native function. Call it like reverseip 12.34.56.78 to have it print 78.56.34.12. Call it like reversed=$(reverseip 12.34.56.78) to capture the output into a variable. reverseip () { local IFS IFS=. set -- $1 echo $4.$3.$2.$1 }


1

basicly BASH scripts provides all you would need with full fledged loops and conditions, variables and system calls, so that you can affect all the aspects of the system and automate tasks, and i think GNU/Linux in general is the master,in this kind of stuff, so VBS or JS, you have it in the form of Shell scripts, like i mentioned BASH is the famous amongs ...


0

As darent and user68186 explained the script may not have the executable bit set. If the bit is set you can run the script if you're in the directory the script is in simply by prefixing it with ./. For example: ./myscript.sh You don't have to have the .sh at the end of the filename either, but it's good form to append the .sh to let others know it's a ...


4

When you type sh somescript.sh, the system looks for sh in the path not somescript.sh. Then the system finds sh and passes the argument somescript.sh to it. Then sh looks for somescript.sh in the current folder or in the specified folder ~/bin/ if you typed sh ~/bin/somescirpt.sh. To make the system look for somescript.sh in the path use it directly ...


0

As the comment said, your script may not be marked for execution. When you call it trough sh what you're doing is telling the shell to read its content and execute the functions inside the text file, is not the same as calling an executable directly. Try this: chmod +x ~/bin/killwine.sh Then, try to execute it again from another directory. Also, make sure ...


2

Since you did $(adduser ..) instead of simply adduser .., you apply command substitution and that line is replaced with the output of that command. So if adduser produces an output of Adding user ..., then the shell will try to execute Adding user ... as a command. Instead, do: id -u ${username} > /dev/null 2>&1 if [ $? -eq 1 ]; then echo ...


0

Go to the Jason-1.3.9/bin folder : Run command sh jason.sh


0

You need to use pre-seeding. The debconf-set-selections command presets answers asked by debconf before installing the package. E.G. sudo debconf-set-selections <<< "shared/accepted-oracle-license-v1-1 boolean true" Then install the package. sudo apt-get install -y oracle-java7-installer


1

Probably tons of different ways there but here's a pythonic one: #!/usr/bin/python import os, glob for filename in glob.glob('*.*'): if os.popen('exif %s | grep Manufacturer | grep Motorola' % filename).read(): os.remove(filename) Yeah, the filepattern is *.* and it simply checks for words Manufacturer and Motorola in the same line from the ...


1

echo 411.311.211.111 | awk -F. '{print $4"."$3"." $2"."$1}'` Output: 111.211.311.411 or echo 411.311.211.111 | awk -F. '{OFS="."; print $4,$3,$2,$1}'


0

From the guest session, press Ctrl+Alt+F1, log into your main account, delete the file, log out, press Ctrl+Alt+F7, log back in. Done!


1

Try doing this using a here-document : vech=Bus echo $vech /bin/bash<<EOF echo "before empty line" echo $vech echo "after empty line" vech=Car echo $vech exit EOF echo $vech


0

Use: #!/bin/bash find "$1" -size 0 -type f -delete You can also do: #!/bin/bash cd "$1" && find . -size 0 -type f -delete


2

The script below watches a textfile that you can edit. If the file is changed, it will create a new layer over your wallpaper with the text of the file. Options you can define: text size text color number of columns (max) number of lines per column border width (around the text blocks) How to use The script uses Imagemagick, you might have to install ...


1

Using wildcards in the sudoers file In the sudoers file, you can use wildcards (*), thus creating the possibility to run a script with arguments. An example I tested it with a shockingly simple python script. In the sudoers file I had to use the absolute path to python: /usr/bin/python in the line of the sudoers file: jacob ALL=NOPASSWD: ...


0

We had this problem on some hosted servers loading FW rules. On these boxes they reboot VERY quickly and we found just putting a "sleep 1" in rc.local before the load statements seems to fix the issue. I guess it gave a little time for the interfaces to settle before loading the FW rules.


2

rm $(ls -lo|grep -v [Pp][Dd][Ff]$|awk '{print $7}') Warning! Better try first ls -l $(ls -lo|grep -v [Pp][Dd][Ff]$|awk '{print $7}')


3

I usually solve such problems from the interactive Python interpreter: mic@mic ~ $ python >>> import os >>> for f in os.listdir('.'): ... if not f.endswith('.pdf'): ... os.remove(f) It might be longer than a one-liner with find or xargs, but it's extremely resilient, and I know exactly what it does, without having to research it ...


0

Since the scheduled tasks needs a command, and apparently simply visiting the URL is all that's needed, you can use a program which will fetch that URL: wget http//www.mysiteserverA.com/run.php This actually downloads the response from that page (to somewhere, I'm not sure where the scheduler sets the working directory to). To suppress this, and any other ...


1

Inspired by choroba's answer: find . -iname '*run.sh' -printf 'cd %h; ./%f\0' | xargs -L1 -0 -P0 bash -c You can use -printf to build the command line. %h is the directory where the file is located, and %f is the name of the file without the path (the basename). The -P option enables parallelism in xargs, and -L1 -0 makes it use one null-terminated line ...


1

What about creating the command lines you want to run, then running them? find . -name '*run.sh' -type f -exec \ echo 'c={}; cd ${c%/*} && nohup "./${c##*/}" &' \; If the output is what you want, just append | bash and run again.


2

Be careful and compose: use xargs Here's an approach I like, because it lets me be very careful: compose a way to show just the files I want to delete, then send them to rm using xargs. For example: ls shows me everything ls | grep pdf shows me the files I want to keep. Hmm. ls | grep -v pdf shows the opposite: all except what I want to keep. In other ...


3

Just like the error says: createdep is not a program. Change this: echo $(createdep) mkdir createdep to this: echo "$createdep" mkdir "$createdep" Note that the format string for date can contain regular characters too, so you don't need the "now" variable: createdep=$(date +"nowt_%H_%M_%S")


11

Delete to trash: $ cd <the directory you want> $ gvfs-trash !(*.pdf) Or via mv command: mv !(*.pdf) ~/.local/share/Trash/files



Top 50 recent answers are included