Solution:
instead of sudo cd dir
do
sudo -i
and then
cd dir
With 'kill -9 processID' you can kill any process that you like however when you have many processes running, this might be time consuming. In this case, you can use 'grep' command to find your processes - then run kill -9 on all of them.
For example, if you have run a bash script called upload.audio.sh, you can first find those using grep, then extract PID using awk, and finally kill the process. The full command is as follows:
ps -ef | grep "upload.audio.sh" | grep -v grep | awk '{print $2}' | xargs kill -9
wget -t 45 -o log http://downloads.dbpedia.org/3.7/en/article_categories_en.nq.bz2 &
(make 45 attempts and write log to log)
Now if you want to download a list of files from some location than
wget -t 45 -o log http://downloads.dbpedia.org/3.7/en/*.bz2 &
will not work so you need to do:
wget -o log -r -l1 --no-parent -A.bz2 http://downloads.dbpedia.org/3.7/en/ &
to download all your files to your local drive.
bunzip2 file-name.bz2
It depends on the tar file. ".tgz" "_tar.gz" means it is tarred and gzipped.
in that case:
tar -zxvf file_tar.gz
If it is just ".tar" "_tar" it isn't zipped, so take the z off.
"tar -xvf file_tar"
tar and gziP:
tar czvf myfile.tgz myfile
Solaris:
"gtar xzvf file.tar.gz" or "gunzip -c file.tar.gz |tar xvf -"
unzip -d thedir archive.zip
chmod a-w filename
for file in *.txt; do echo $file; done
will print all files with extension .txt to console
do:
ps axf | grep [j]ava.endorsed.dir
(or
ps ax | grep [j]ava.endorsed.dir
on Mac)
this will show the PID which you then need to kill:
kill -9 PID
ps auxgwwww | less
sudo lsof -i :80
Cat /etc/passwd |grep "/home" |cut -d: -f1
open -a TextEdit nameOfTheFile.txt
An example downloading FIBO ontologies:
wget -r -l3 --no-parent -A.rdf http://www.omg.org/spec/EDMC-FIBO/FND/20141101/
1) Install all of them e.g. 1.6, 1.7, and 1.8.
2) Add to your ~/.bash_profile
export JAVA_HOME=$(/usr/libexec/java_home -v 1.7) setjdk() { export JAVA_HOME=$(/usr/libexec/java_home -v $1) }
Now you can:
$ java -version java version "1.7.0_51" Java(TM) SE Runtime Environment (build 1.7.0_51-b13) Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode) $ setjdk 1.6 $ java -version java version "1.6.0_65" Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609) Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode) $ setjdk 1.8 $ java -version java version "1.8.0" Java(TM) SE Runtime Environment (build 1.8.0-b132) Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)
Source: http://superuser.com/questions/650310/switching-between-java-7-and-8-in-os-x
To write the output of the System.err.println to the file do the following:
> outputfilename.log 2>&1
For example, to find out what's running on port 9000, run this command:
$ lsof -i :9000
conda info --envs
After updating my iOS recently to Mohave 10.14 I encountered this exception and solved it following the advice from this link
1. Check the value for your $TERM variable:
echo $TERM
xterm-256color
2. Update it:
export TERM=xterm-color
3. Carry on, it works!
Full exception:
[ERROR] Failed to construct terminal; falling back to unsupported
java.lang.NumberFormatException: For input string: "0x100"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:580)
at java.lang.Integer.valueOf(Integer.java:766)
at jline.internal.InfoCmp.parseInfoCmp(InfoCmp.java:59)
at jline.UnixTerminal.parseInfoCmp(UnixTerminal.java:242)
at jline.UnixTerminal.<init>(UnixTerminal.java:65)
at jline.UnixTerminal.<init>(UnixTerminal.java:50)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at java.lang.Class.newInstance(Class.java:442)
at jline.TerminalFactory.getFlavor(TerminalFactory.java:211)
at jline.TerminalFactory.create(TerminalFactory.java:102)
at jline.TerminalFactory.get(TerminalFactory.java:186)
at jline.TerminalFactory.get(TerminalFactory.java:192)
at jline.console.ConsoleReader.<init>(ConsoleReader.java:243)
at jline.console.ConsoleReader.<init>(ConsoleReader.java:235)
at jline.console.ConsoleReader.<init>(ConsoleReader.java:223)
at sbt.JLine$$anonfun$createReader$1.apply(LineReader.scala:103)
at sbt.JLine$$anonfun$createReader$1.apply(LineReader.scala:102)
at sbt.JLine$$anonfun$usingTerminal$1.apply(LineReader.scala:98)
at sbt.JLine$$anonfun$usingTerminal$1.apply(LineReader.scala:96)
at sbt.JLine$.withTerminal(LineReader.scala:89)
at sbt.JLine$.usingTerminal(LineReader.scala:96)
at sbt.JLine$.createReader(LineReader.scala:102)
at sbt.SimpleReader.<init>(LineReader.scala:139)
at sbt.SimpleReader$.<init>(LineReader.scala:141)
at sbt.SimpleReader$.<clinit>(LineReader.scala)
at sbtrelease.ReleaseStateTransformations$.readVersion(ReleaseExtra.scala:274)
at sbtrelease.ReleaseStateTransformations$$anonfun$inquireVersions$1.apply(ReleaseExtra.scala:67)
at sbtrelease.ReleaseStateTransformations$$anonfun$inquireVersions$1.apply(ReleaseExtra.scala:56)
at sbtrelease.ReleasePlugin$autoImport$ReleaseKeys$$anonfun$4.sbtrelease$ReleasePlugin$autoImport$ReleaseKeys$$anonfun$$filterFailure$1(ReleasePlugin.scala:150)
at sbtrelease.ReleasePlugin$autoImport$ReleaseKeys$$anonfun$4$$anonfun$7$$anonfun$apply$3.apply(ReleasePlugin.scala:164)
at sbtrelease.ReleasePlugin$autoImport$ReleaseKeys$$anonfun$4$$anonfun$7$$anonfun$apply$3.apply(ReleasePlugin.scala:164)
at scala.Function$$anonfun$chain$1$$anonfun$apply$1.apply(Function.scala:24)
at scala.Function$$anonfun$chain$1$$anonfun$apply$1.apply(Function.scala:24)
at scala.collection.LinearSeqOptimized$class.foldLeft(LinearSeqOptimized.scala:111)
at scala.collection.immutable.List.foldLeft(List.scala:84)
at scala.collection.TraversableOnce$class.$div$colon(TraversableOnce.scala:138)
at scala.collection.AbstractTraversable.$div$colon(Traversable.scala:105)
at scala.Function$$anonfun$chain$1.apply(Function.scala:24)
at sbtrelease.ReleasePlugin$autoImport$ReleaseKeys$$anonfun$4.apply(ReleasePlugin.scala:168)
at sbtrelease.ReleasePlugin$autoImport$ReleaseKeys$$anonfun$4.apply(ReleasePlugin.scala:132)
at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:59)
at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:59)
at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:61)
at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:61)
at sbt.Command$.process(Command.scala:93)
at sbt.MainLoop$$anonfun$1$$anonfun$apply$1.apply(MainLoop.scala:96)
at sbt.MainLoop$$anonfun$1$$anonfun$apply$1.apply(MainLoop.scala:96)
at sbt.State$$anon$1.doX$1(State.scala:183)
at sbt.State$$anon$1.process(State.scala:190)
at sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:96)
at sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:96)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
at sbt.MainLoop$.next(MainLoop.scala:96)
at sbt.MainLoop$.run(MainLoop.scala:89)
at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:68)
at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:63)
at sbt.Using.apply(Using.scala:24)
at sbt.MainLoop$.runWithNewLog(MainLoop.scala:63)
at sbt.MainLoop$.runAndClearLast(MainLoop.scala:46)
at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:30)
at sbt.MainLoop$.runLogged(MainLoop.scala:22)
at sbt.StandardMain$.runManaged(Main.scala:109)
at sbt.xMain.run(Main.scala:38)
at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109)
at xsbt.boot.Launch$.withContextLoader(Launch.scala:128)
at xsbt.boot.Launch$.run(Launch.scala:109)
at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35)
at xsbt.boot.Launch$.launch(Launch.scala:117)
at xsbt.boot.Launch$.apply(Launch.scala:18)
at xsbt.boot.Boot$.runImpl(Boot.scala:41)
at xsbt.boot.Boot$.main(Boot.scala:17)
at xsbt.boot.Boot.main(Boot.scala)
This will replace mac new lines with unix new lines:
tr '\r' '\n' < myfile-with-mac-new-line.tsv > new-file-with-unix-new-line.tsv
This will replace old_string with new_string:
:%s/old_string/newstring/g