Friday, October 13, 2017

To copy and paste on Linux console screen (using screen)

$ screen

<CTRL A><CTRL C>     -  Create a new screen
<CTRL A><SPACE>       - Cycle to the next screen

To Copy and Paste
<CTRL A>[                      - Enter Mark mode.  Use VI navigation keys to move around screen.  Use <SPACE> or <ENTER> to mark the beginning and then the end of the block

<CTRL A>]                      - Paste selected text

Sunday, August 6, 2017

Command not found when using sudo

Give sudo your current PATH with:
sudo env "PATH=$PATH" your_command
 
 
Elaborating on @opyate's answer, I am using the following shell script (which may be named mysudo, for example):
#!/bin/bash
sudo -E env "PATH=$PATH" "$@"
  • -E tells sudo to preserve the environment.
  • env "PATH=$PATH" is expanded outside the sudo call, making the external PATH available inside the sudo too (this is required in addition to the -E as the PATH usually receives special treatment in addition to the treatment the entire environment receives).
  • "$@" passes the arguments our script receives to the sudo line.
Save the script in a file in a directory in the PATH, give it +x permissions, et voilĂ .
 
Since the current answers are a little vague, the specific setting in /etc/sudoers changing your path is secure_path:
Defaults    secure_path = /sbin:/bin:/usr/sbin:/usr/bin
You can modify it it with sudo visudo, or better yet, add the directories you need:
Defaults    secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
shareimprove this answer
 
 

Saturday, August 5, 2017

Run multiple command together

command1 && command2
    run command2 only if command1 is success

command1 || command2
    run command2 only if command1 failed.

command1 ; command2
    run command2 after command1 no matter what happen to command1



How to get System Information in Ubuntu

sudo lshw -short
sudo lshw -html >sysiinfo.html
lscpu lsblk lspci lsusb
dmidecode
sudo dmidecode -l memory
ex. memory, baseboard, bios, processor, chassis,

To add more desktops to Ubuntu

sudo apt install ubuntu-gnome-desktop

Choose lightdm
Logout and click on Ubuntu Logo
Choose gnome desktop

sudo apt install cinnamon-desktop-environment -y


Sunday, June 4, 2017

Fix "package is in a very bad inconsistent state" error

dpkg: error processing package libllvm4.0:i386 (--configure):
 package is in a very bad inconsistent state; you should
 reinstall it before attempting configuration
Errors were encountered while processing:
 libllvm4.0:i386
E: Sub-process /usr/bin/dpkg returned an error code (1)



sudo apt-get install -f --reinstall libllvm4.0:i386

Saturday, April 22, 2017

Ubuntu 16.04 Installation Notes

Install JDK via webupd8

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer


Switching between Oracle Java 8 and Java 7


Later on, if you want to switch Oracle Java 7, use the following command (make sure "oracle-java7-installer" package is installed):
sudo update-java-alternatives -s java-7-oracle

And, switch back to Oracle Java 8 using:
sudo update-java-alternatives -s java-8-oracle

Setting Java environment variables


To automatically set up the Java 8 environment variables, you can install the following package:
sudo apt-get install oracle-java8-set-default

If you've already installed oracle-java6-set-default or oracle-java7-set-default, they will be automatically removed when installing oracle-java8-set-default (and the environment variables will be set for Oracle Java 8 instead).

Enable hgfs 

In VMWare Workstation -> always enable folder sharing, add folder

sudo apt install open-vm-tools open-vm-tools-desktop

vmhgfs-fuse --version
sudo vmware-hgfsclient
ls -alh /mnt
mkdir /mnt/hgfs
sudo vmhgfs-fuse -o allow_other .host:/src /mnt/hgfs
ls -alh /mnt/hgfs

Install Chrome x64
Download/install from google chrome website via Firefox

sudo apt install vim vim-doc emacs gdebi 


Install Ubuntu Make
sudo add-apt-repository ppa:ubuntu-desktop/ubuntu-make
sudo apt update
sudo apt install ubuntu-make
Then run "umake --help" in a terminal to see all the available options.

umake go
umake swift
umake dart
umake scala
umake rust

rust doesn't work
install from official source


curl -sSf https://static.rust-lang.org/rustup.sh | sh



umake ide eclipse

eclisp dosn't work.
umake ide netbeans
umake ide visual-studio-code


IntelliJ IDEA

IntelliJ IDEA 15 and above should include HiDPI support.[2] If it does not work, the most convenient way to fix the problem in this case seems to be changing the Override Default Fonts setting:
File -> Settings -> Behaviour & Appearance -> Appearance
The addition of -Dhidpi=true to the vmoptions file in either $HOME/.IdeaC14/ or /usr/share/intelligj-idea-ultimate-edition/bin/ of release 14 should not be required anymore.

NetBeans

NetBeans allows the font size of its interface to be controlled using the --fontsize parameter during startup. To make this change permanent edit the/usr/share/netbeans/etc/netbeans.conf file and append the --fontsize parameter to the netbeans_default_options property.[3]
The editor fontsize can be controlled from Tools → Option → Fonts & Colors.

The output window fontsize can be controlled from Tools → Options → Miscelaneous → Output



sudo apt install gnat-gps

As of 9/3/2016, install gnat-gps will also force install gnat-4.9 automatically. Install gnat-5 after installed gnat-gps will remove gnat-4.9.

sudo apt install gnat-5 gnat-5-doc ada-reference-manual-2012

Install MySQL

https://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/


Install mongodb
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/


sudo service mongod start

SDKMAN!

An easier way to install Kotlin on UNIX based systems such as OS X, Linux, Cygwin, FreeBSD and Solaris is by using SDKMAN!. Simply run the following in a terminal and follow any instructions:
   $ curl -s https://get.sdkman.io | bash
Next open a new terminal and install Kotlin with:
   $ sdk install kotlin
https://kotlinlang.org/docs/tutorials/command-line.html



Install perl6
http://rakudo.org/how-to-get-rakudo/#Installing-Rakudo-Star-Linux


Install Julia
http://julialang.org/downloads/platform.html



sudo apt install ucblogo
sudo apt install lua5.3 liblua5.3-dev

Install ubuntu-sdk --> outdated
http://developer.ubuntu.com/en/phone/platform/sdk/installing-the-sdk/

Install ruby using rvm
http://rvm.io/

curl -L https://get.rvm.io | bash -s stable
rvm list known
rvm install ruby-head
or if it fails
rvm install ruby-2.3

rvm use 2.3
. ~/.profile
ruby -v
rvm use 2.3 --default

https://gorails.com/setup/ubuntu/17.04

Install sfml
sudo apt install libsfml-dev libsfml-doc

Install wxwidgets
https://wiki.wxwidgets.org

sudo apt install libwxgtk3.0-dev wx3.0-doc


Install mono
http://www.mono-project.com/docs/getting-started/install/linux/

To get gtk# :

sudo apt install gtk-sharp2



Install Squeak
Squeak 5 is currently 32bit only. Hence, you need 32bit libraries. It cannot use your 64bit libraries.

You may need thes:e packages (I use Debian/Ubuntu names, CentOS/RH/SuSE should be similar):

libc6:i386
libuuid1:i386
libkrb5-3:i386
libk5crypto3:i386
zlib1g:i386
libcomerr2:i386
libkrb5support0:i386
libkeyutils1:i386
libx11-6:i386
libgl1-mesa-glx:i386
libsm6:i386
libssl1.0.0:i386

(note the :i386 in the names)

In the directory where you unzipped the Squeak-5.0-All-in-One.zip archive, and that contains the squeak.sh file, put the following into a file named libs32.sh :

#!/bin/bash
objdump -p ./Squeak-5.0-All-in-One.app/Contents/LinuxAndWindows/Linux-i686/lib/squeak/5.0-3397/*|
grep NEEDED|
awk '{print $2}'|
sort -u|
xargs dpkg -S|
awk '{print $1}'|
sort -u|
sed 's/:amd64:/:i386:/'|
sort -u|
sed 's/:$//'
Make that file executable:

chmod +x ./libs32.sh
Run it:

./libs32.sh
You will get a list of libraries that need to be installed.

Run

./libs32.sh | xargs sudo apt install
to see what would be installed.

Run

./libs32.sh | xargs sudo apt install -y

to install it.

Linux: 

        There are two variants of the Linux VMs; those ending in "ht" have a 
        heartbeat thread, while those that don't, use an interval timer for the 
        heartbeat (the Windows and Mac VMs have a threaded heartbeat).  The 
        threaded heartbeat is better (for example, signals from the interval timer 
        interfere with system calls, etc), but to use it one must have a kernel 
        later than 2.6.12 and configure linux to allow the VM to use multiple 
        thread priorities.  To do so, create a file called VM.conf where VM is 
        the name of the vm executable ("squeak" for the Squeak vm, "nsvm" for 
        the Newspeak vm) in /etc/security/limits.d/ with contents: 
*       hard    rtprio  2 
*       soft    rtprio  2 

        e.g. 
sudo cat >/etc/security/limits.d/squeak.conf <<END 
*       hard    rtprio  2 
*       soft    rtprio  2 
END 

sudo cp /etc/security/limits.d/squeak.conf /etc/security/limits.d/nsvm.conf

        Then log out and log back in for the limits to take effect. 


install sdl2
https://wiki.libsdl.org/Installation
sudo apt install libsdl2-dev


To compile program
gcc -o 01_hello_SDL 01_hello_SDL.cpp `sdl2-config --cflags --libs`

Steam

You have to delete steam's own lib using:
find ~/.steam/root/ -name "libgpg-error.so*" -print -delete


The HiDPI-Steam-Skin can be installed to increase the font size of the interface. While not perfect, it does improve usability.
Note: The skin must be downloaded to ~/.local/share/Steam/skins, not ~/.steam/skins/ as the README says.


Install Atom

To install this PPA:

sudo add-apt-repository ppa:webupd8team/atom 
sudo apt-get update
sudo apt-get install atom
Change ui and editor font size

Create/edit ~/.atom/styles.less

Or you can also change it in your styles.less file with:
.theme-one-dark-ui {
  font-size: 18px;
}
In Settings -> Editor Settings -> Font Size -> set to 20


Bind changing font size to control+/-

https://github.com/atom/atom/issues/11905#issuecomment-224865625


Install d-lang

https://dlang.org/download.html#dmd


curl -fsS https://dlang.org/install.sh | bash -s dmd
######################################################################## 100.0%
The latest version of this script was installed as ~/dlang/install.sh.
It can be used it to install further D compilers.
Run `~/dlang/install.sh --help` for usage information.

Downloading and unpacking http://downloads.dlang.org/releases/2.x/2.071.2/dmd.2.071.2.linux.tar.xz
######################################################################## 100.0%
Downloading https://dlang.org/d-keyring.gpg
######################################################################## 100.0%
Downloading and unpacking http://code.dlang.org/files/dub-1.0.0-linux-x86_64.tar.gz
######################################################################## 100.0%

Run `source ~/dlang/dmd-2.071.2/activate` in your shell to use dmd-2.071.2.
This will setup PATH, LIBRARY_PATH, LD_LIBRARY_PATH, DMD, DC, and PS1.
Run `deactivate` later on to restore your environment.


Install OpenCobol, OpenCobolIDE

sudo apt install open-cobol


sudo apt install python3-pip

pip3 install pyqode.core --user
pip3 install pyqode.cobol --user
pip3 install pygments --user
pip3 install PyQt5
sudo pip3 install OpenCobolIDE --upgrade

opencobolide


Install Guile

sudo apt install guile-2.0 guile-2.0-dev guile-2.0-doc


Install lisp-in-a-box with sbcl



Install Emacs (IDE):
sudo apt-get install emacs
Install SBCL (Compiler):
sudo apt-get install sbcl
Install Quicklisp (Quicklisp is a library manager for Common Lisp.)
This is done by copy-and-pasting all bold commands in the grey box here: https://www.quicklisp.org/


curl -O https://beta.quicklisp.org/quicklisp.lisp 
curl -O https://beta.quicklisp.org/quicklisp.lisp.asc
gpg --verify quicklisp.lisp.asc quicklisp.lisp 
sbcl --load quicklisp.lisp
 
Inside sbcl
(quicklisp-quickstart:install)
(ql:system-apropos "vecto")
(ql:quickload "vecto")
(ql:add-to-init-file)
(quit)
 
Install SLIME by using Qucklisp: In the terminal run SBCL:
sbcl 
(ql:quickload "quicklisp-slime-helper") 
(quit) 
Add this to ~/.emacs.d/init.el

(load (expand-file-name "~/quicklisp/slime-helper.el"))
;; Replace "sbcl" with the path to your implementation
(setq inferior-lisp-program "/usr/bin/sbcl")

  Now inside Emacs to start SLIME type:
M-x slime Which is Alt+x slime.
Now you're ready to play with LISP.


Install Clojure
Use leinigen from http://leiningen.org/

  1. Download the lein script (or on Windows lein.bat)
  2. Place it on your $PATH where your shell can find it (eg. ~/bin)
  3. Set it to be executable (chmod a+x ~/bin/lein)
  4. Run it (lein) and it will download the self-install package
From project folder:

lein run 


Install nodejs and npm

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -

sudo apt-get install -y nodejs



Install Coffee-Script
sudo env "PATH=$PATH" npm install -g coffee-script
coffee

Install objective c, gnustep
sudo apt install gobjc gcc-5-doc
sudo apt install gnustep gnustep-examples gnustep-base-doc


Install latex, thaifont from windows

sudo apt install texlive-xetex

copy windows fonts from windows to ubuntu
right click on the font files in Files Explorer to view and install fonts.

xelatex file.tex
xpdf file.pdf

Install Kodi
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:team-xbmc/ppa
sudo apt-get update
sudo apt-get install kodi

nim

Nim

PPA description

Unofficial package for http://www.nim-lang.org/
Download official binary tar file from the website
tar xf 
cd nim-0.15.0
sh build.sh
add ~/nim-0.15.0/bin to PATH in .profile
Install nimble, aporia
in the ~/nim-0.15.0
nim e install tools.nims
nimble install aporia
Install missing gtksourceview package
sudo apt install libgtksourceview2.0
~/.nimble/bin/aporia
add ~/.nimble/bin to PATH

DR.Racket
sudo add-apt-repository ppa:plt/racket
sudo apt-get update
sudo apt install racket

From Ubuntu Softwares Store installs
Alternatives Configurator
plex media server
sudo gdebi ...
sudo service plexmediaserver status
sudo apt install bsdgames bsdgames-nonfree xshogi xboard eboard tagua quarry
Docker Installation on Ubuntu 17.04
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7EA0A9C3F273FCD8
sudo vi /etc/apt/sources.list.d/docker.list
deb [arch=amd64] https://download.docker.com/linux/ubuntu zesty stable
sudo apt update
sudo apt install docker-ce
sudo usermod -a -G docker user
logout/login
 
Install dotnet with docker
docker run -it --rm microsoft/dotnet
[now in the container]
mkdir app
cd app
dotnet new console
ls
dotnet restore
dotnet run
dotnet bin/Debug/netcoreapp1.0/app.dll
dotnet publish -c Release -o out
dotnet out/app.dll
exit