Skip to content

Latest commit

 

History

History
1483 lines (954 loc) · 37.1 KB

linux.org

File metadata and controls

1483 lines (954 loc) · 37.1 KB

Ubuntu

Clean Install Setup

USB Thumbdrive install

source

[https://help.ubuntu.com/community/Installation/FromUSBStick](https://help.ubuntu.com/community/Installation/FromUSBStick)

From an ubuntu machine do:

“`bash $ sudo apt-get install usb-creator $ usb-creator-gtk “`

Select the ubuntu iso you downloaded

You can delete usb contents first if u want

Select discard saved files

CREATE your bootable usb disk!

Boot other computer from this usb disk drive…follow install instructions.

Packages

First setup your proxy if required for apt-get

$ cat etc/apt/apt.conf Acquire::http::proxy “http://www-proxy.us.oracle.com:80”;

Applications > Ubuntu Software Center > Edit > Software Sources… > Other Software > select the other two partner repositories

Now update your system too:

sudo apt-get update

Export/Import Package list

Do: [List all installed packages][]

Email to self.

Set firefox to auto-detect proxy settings.

  • OR -

One by one:

sudo apt-get install –force-yes -y gnome-do git-core curl emacs thunderbird meld

Compiz

On old computer open CompizConfig Settings Manager, from terminal type:

ccsm

Preferences > Profile > Export

Start `ccsm` from the terminal on the new machine.

Keyboard Shortcuts

System > Preferences > Keyboard Shortcuts >

Desktop > Lock screen (disable (BACKSPACE)) Window Management > Activate the window Menu (disable (BACKSPACE))

Gnome-Do

Launch `gnome-do` from the terminal. Top right triangle > preferences > keyboard > Summon GNOME Do > Alt-space

Chrome

Download, install, latest version of Google chrome.

Setup google chrome preferences > personal stuff ( to sync everything )

Set so default search results are in English:

  1. Go to Wrench > Options (Preferences on Mac) > Basics > Search > Manage
  2. Select Add (“+” sign on Mac)
  3. For “Name” and “Keyword,” type the letter “a”
  4. For “URL,” enter http://www.google.com/search?q=%s
  5. Click O.K.
  6. Select your new search engine from the list and click “Make default”
  7. Click “Close”

Git Projects

email id_rsa.pub to computer that can add you to gitosis-admin

mkdir projects cd projects/ git clone git@linux1.hk.oracle.com:myConfig.git

Also clone project(s): `documentation`. Setup your info:

~$ git config –global user.name “Fenton Travers” ~$ git config –global user.email fenton.travers@gmail.com

Emacs

cd ~/projects/myConfig/ cp -rp emacs.d/* ~/.emacs.d/ cp -rp emacs ~

Check the http proxy in `~/.emacs.d/init.el`, if required put it in:

(setq url-proxy-services ‘((“no_proxy” . “work\.com”) (“http” . “www-proxy.us.oracle.com”)))

Eclipse

Download, install eclipse to `~/bin/eclipse`. Create the file `~/bin/Eclipse.desktop` with the following contents:

$ cat Eclipse.desktop [Desktop Entry] Name=Eclipse Helios Comment=Eclipse Helios IDE Exec=/home/oracle/bin/eclipse/eclipse Icon=/home/oracle/bin/eclipse/icon.xpm Type=Application Categories=Development;IDE;

Install with:

desktop-file-validate Eclipse.desktop sudo desktop-file-install Eclipse.desktop

Uninstall:

If you mess up, delete the *.desktop file from `/usr/share/applications`

Add: `pydev` from the eclipse marketplace

Maven

Copy `settings.xml` file into `~/.m2/` folder

cp ~/projects/myConfig/settings.xml ~/.m2/

Thunderbird

To change your timezone on Beehive do:

https://stbeehive.oracle.com/bcentral/action?page=myaccount

To change timezone in Thunderbird (with Lightning)

Edit > Preferences > Calendar (tab) > Timezone (tab)

After put in details and it fails to auto setup click: Manual Setup

Account Settings > fenton.travers@oracle.com >

Account Name: fenton.travers@oracle.com

Account Settings > fenton.travers@oracle.com > Server Settings >

Server Name: stbeehive.oracle.com

Port: 993

User Name: fenton.travers@oracle.com

Account Settings > fenton.travers@oracle.com > Server Settings > Security Settings >

Connection Security: SSL/TLS

Authentication method: Normal password

Account Settings > Outgoing Server(SMTP) >

Server Name: stbeehive.oracle.com Port: 465 User Name: fenton.travers@oracle.com Authentication Method: Normal Password Connection Security: SSL/TLS

On old machine:

cd ~/.thunderbird tar cvfz mail.tgz *

Extract on new machine:

cd ~/.thunderbird tar xvfz mail.tgz

Import Compiz profile

Web Downloads

Eclipse, SQLDeveloper, Skype, Adobe Acrobat Reader

VNC

You would like to be able to VNC into your machine. Follow [setup instructions](https://help.ubuntu.com/community/VNC)

Google Desktop

Download and install from internet.

Add folders:

/home/oracle/projects/documentation

/home/oracle/projects/work-doco

Which other folders hmm…

Google Talk

http://www.google.com/talk/

Terminal Settings

Open terminal: Edit > Profile Preferences > General (tab) > Monospace 9 Edit > Profile Preferences > Scrolling > Unlimited (checked)

Pidgin

Tools > Preferences > Show system tray icon: Always

Oracle Account

Basic

“` protocol: xmpp username: fenton.travers domain: oracle.com password: put it in and check: Remember password “`

Advanced

“` Connection security: Use old-style SSL connect port = 5223 connect server = stbeehive.oracle.com File transfer proxies: (clear this entry) “`

Notifications

Tools > Plugins > Libnotify Popups > Configure Plugin > Uncheck: Buddy signs on

Set Open DSN Servers

set /etc/resolv.conf

nameserver 208.67.222.222 nameserver 208.67.220.220

Printers

  • PDF’s can be found in ~/PDF, can view with `xdg-open <pdf_name>`
  • Add a printer from `http://localhost:631`, local username password.
    • CUPS for Administrators > Adding Printers and Classes > Printers > Find New Printers > Add This Printer:
  • - HP LaserJet P2015 Series Postscript (recommended) (en, da, de, es, fi, fr, it, ja, ko, nl, nb, pt, sv, zh_CN, zh_TW)
    • Connection:

dnssd://HP%20LaserJet%20P2015%20Series%20(0D9452)._pdl-datastream._tcp.local/

hostnames for printers:

  • p2015.hk.oracle.com – 10.179.252.21

connection string

  • Connection: socket://p2015.hk.oracle.com:9100

Environment, Aliases

Run: `~/myConfig/setConfigRsync.sh`

Get Things Gnome tasks

cd ~/projects/myConfig; sudo cp gtg_data.tgz /; cd /; tar xvfz gtg_data.tgz

SQLDeveloper

$ cat SQLDeveloper.desktop [Desktop Entry] Name=SQL Developer Comment=SQL Developer Program Exec=/bin/sh /home/f/bin/sqldeveloper/sqldeveloper.sh Icon=/home/f/bin/sqldeveloper/icon.png Type=Application Categories=Development;Database; Path=/home/f/bin/sqldeveloper/

See [here](#ubuntuInstall) for specific details.

desktop-file-validate SQLDeveloper.desktop sudo desktop-file-install SQLDeveloper.desktop

Run SQLDeveloper once by hand to set the JDK path.

/bin/sh /home/oracle/bin/sqldeveloper/sqldeveloper.sh

set your jvm home to: `/usr/lib/jvm/java-6-sun`

Now you should find the icons to launch the apps under: Applications > Programming.

Mint Specific

[ruby install](ruby.html#Install)

Compiz

In version 11 can switch from metacity to compiz with:

“`bash compiz –replace & “`

if u wanted to go back u could with:

“`bash metacity –replace & “`

then log out.

Eclipse

Unzip the eclipse download into: `~/bin/eclipse-jee-indigo`

Create a file, `EclipseJee.desktop`, with the following contents:

[Desktop Entry] Name=Eclipse Indigo JEE Comment=Eclipse Indigo JEE - IDE Exec=/home/oracle/bin/eclipse-jee-indigo/eclipse Icon=/home/oracle/bin/eclipse-jee-indigo/icon.xpm Type=Application Categories=Development;IDE; Path=/home/oracle/bin/eclipse-jee-indigo/

Run:

desktop-file-validate EclipseJee.desktop sudo desktop-file-install EclipseJee.desktop

to install it.

Uninstall

If you mess up, delete the *.desktop file from `/usr/share/applications`

Startup Programs

System > Preferences > Startup Applications … add

  • Name: Pidgin, Command: /usr/bin/pidgin

VPN

“` $ sudo /etc/rc.d/vpnagentd_init start $ ~/vpnui “`

Oracle VPN username (with the 8 character_cc)

Click AnyConnect, download & run shell script.

Server to connect to: `rmdc-twvpn-2.oraclevpn.com,

au-enc.oracle.com, rm-enc.oracle.com, hq-enc.oracle.com, jp-enc.oracle.com`

Config

  • [Generate your ssh key pair](/secure.html#keypair)
  • Add plugin downthemall to firefox.

Netbeans

~/Downloads$ chmod 755 netbeans-6.9.1-ml-java-linux.sh ~/Downloads$ ./netbeans-6.9.1-ml-java-linux.sh

Documentation

I have documentation that I publish to a local webserver.

Multimarkdown

“`bash $ cd ~/bin/; $ wget –user=spiceman –password=<PASSWORD> http://software.spicevan.com/linux/fletcher-MultiMarkdown-ef1038d.tar.gz $ tar xvfz fletcher-MultiMarkdown-ef1038d.tar.gz $ ln -s fletcher-MultiMarkdown-ef1038d/ mmd

$ wget –user=spiceman –password=<PASSWORD> http://software.spicevan.com/linux/mylynWikitext.tgz $ tar xvfz mylynWikitext.tgz “`

Add following to end of: /etc/apache2/apache2.conf

“`apache <VirtualHost *:80> ServerName docs DocumentRoot /home/f/bin/website </VirtualHost> “`

Then you can run command: `lochtml`

Clojure

see: [Clojure Install](clojure.html)

Package Management – Debian Systems

Package Details

[Good reference site](http://newbiedoc.sourceforge.net/tutorials/apt-get-intro/info.html.en)

List all available packages in repos

Sample below searches for Java 5.

cd /var/lib/apt/lists grep Package * | grep java | grep 5

List all installed packages

dpkg –get-selections > installed-software

Re-install based on above list

sudo apt-get install dselect; sudo dpkg –set-selections < installed-software; sudo dselect

Choose option [3] Install.

Package info

To determine info about a given package do:

dpkg -p <package_name> dpkg -p clisp

List files installed to your system from package.

dpkg -L package-Name

List contents of a deb package.

dpkg -c filename

re-install

apt-get –reinstall install

purge

apt-get –purge remove

can also do: `dpkg –purge <package>` then try re-install

Package Management – Redhat

list package files:

rpm -ql

Setting up Lisp

Install clisp

sudo apt-get install clisp

slime

[Slime Documentation](http://common-lisp.net/project/slime/doc/html/)

installation just requires a few lines in your .emacs:

(setq inferior-lisp-program ”usr/bin/clisp”) ; your Lisp system (add-to-list ‘load-path “~/bin/slime-2010-11-09”) ; your SLIME directory (require ‘slime) (slime-setup)

Run it in emacs with: `Alt-x slime`

Networking

Interfaces

Startup/Shutdown an interface:

sudo ifconfig [interface] [up/down]

Example: shutdown interface `eth0`:

sudo ifconfig eth0 down

Restart Network

Debian systems:

sudo /etc/init.d/networking restart

Startup, Shutdown, Scripts

To make it usable, and make possible it’s automatic startup on server boot change its permissions and update-rc.d

sudo chmod +x /etc/init.d/git-daemon sudo update-rc.d git-daemon defaults

The daemon can be started or stoped by accesing:

sudo /etc/init.d/git-daemon start sudo /etc/init.d/git-daemon stop

To remove the file, just replace the word default with remove:

update-rc.d git-daemon remove

Java JDK

Set the JAVA_HOME variable in /etc/environment. Sample:

sudo vi /etc/environment JAVA_HOME=”/opt/java/java-6-oracle;”

Screen Capture

Shutter

Web Server

sudo /etc/init.d/apache2 restart /etc/apache2/apache2.conf

SSL Web Server

sudo a2enmod ssl sudo nano /etc/apache2/sites-available/default-ssl # set DocumentRoot etc sudo a2ensite default-ssl sudo service apache2 restart

SQLDeveloper, Eclipse, IntelliJ

See [here](#ubuntuInstall) for specific details.

cd projects/myConfig/ desktop-file-validate Eclipse.desktop desktop-file-validate SQLDeveloper.desktop sudo desktop-file-install Eclipse.desktop sudo desktop-file-install SQLDeveloper.desktop

Run SQLDeveloper once by hand to set the JDK path.

/bin/sh /home/oracle/bin/sqldeveloper/sqldeveloper.sh

set your jvm home to: /usr/lib/jvm/java-6-sun

Now you should find the icons to launch the apps under: Applications > Programming.

Installing Programs

you can create a *.desktop file like:

[Desktop Entry] Name=Eclipse - Helios Comment=Eclipse - Helios, IDE Exec=/home/ftravers/bin/eclipse_helios/eclipse/eclipse Icon=/home/ftravers/bin/eclipse_helios/eclipse/icon.xpm Type=Application Categories=Development;IDE; Path=/home/ftravers/bin/eclipse_helios/eclipse/

format description can be found here:

http://www.freedesktop.org/wiki/Howto_desktop_files

valid categories can be found here:

http://standards.freedesktop.org/menu-spec/latest/apa.html

You may want to pass $ `desktop-file-validate foo.desktop` to check out that your file is OK.

Then, you can install it: `sudo desktop-file-install foo.desktop`

In the above example we’ll now find the Eclipse icon in the folder: Applications > Programming.

You can add it to the menu bar by right-clicking and choosing add to panel.

Uninstall

If you mess up, delete the *.desktop file from `/usr/share/applications`

Multiple Network Interfaces

Here I have an internal (company) ethernet connection, behind a corporate firewall, eth0. I also have a network connection through my usb with my phone tethered on it, i.e. a 3G network. This is on network interface: usb0.

I have some servers on the internet that I like to `ssh` to, but my corporate firewall blocks this, so I’d like to setup a static route to these servers that goes over the usb0 network interface, which doesn’t block these types of connections.

The server I want to connect to is at IP address: `208.113.135.25`, so I issued the following command:

sudo route add -net 208.113.135.0 netmask 255.255.255.0 dev usb0

which means send any packets that are destined for the 208.113.135/24 network out over the usb0 network interface. This doesn’t work yet! First lets look at the routing table with `netstat -r`:

$ netstat -r Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 10.179.252.0 * 255.255.255.0 U 0 0 0 eth0 208.113.135.0 * 255.255.255.0 U 0 0 0 usb0 192.168.42.0 * 255.255.255.0 U 0 0 0 usb0 link-local * 255.255.0.0 U 0 0 0 eth0 default leegarden-swi-1 0.0.0.0 UG 0 0 0 eth0

Lets switch over to using only the usb0 interface

sudo ifconfig eth0 down

and grab the routing table when using it, using: `route -e` or `netstat -r` gives the following info:

$ netstat -r Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 208.113.135.0 * 255.255.255.0 U 0 0 0 usb0 192.168.42.0 * 255.255.255.0 U 0 0 0 usb0 default 192.168.42.129 0.0.0.0 UG 0 0 0 usb0

Adding the static route did not help, so I remove it.

$ sudo route delete -net 208.113.135.0 netmask 255.255.255.0 oracle@oracle:/etc/iproute2$ netstat -r Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 10.179.252.0 * 255.255.255.0 U 0 0 0 eth0 192.168.42.0 * 255.255.255.0 U 0 0 0 usb0 link-local * 255.255.0.0 U 0 0 0 eth0 default leegarden-swi-1 0.0.0.0 UG 0 0 0 eth0

General Unix Commands

Disk Usage - du

To find which folders (to a max depth of 4 deep) are consuming space use:

du –max-depth=4 . | sort -n

find

Find all files accessed in the last minute

find . -mmin 1

grep

Find all files (recurse into subdirectories ®) that have the word ‘fenton’ in them (ignore case (i)). Only search files ending in “*.java” (–include).

grep -iR fenton –include=”*.java” .

Tiff2Pdf

xmllint

The following will take an xml file and format it so it’s all properly indented.

xmllint –format fenton.xml > cleanFenton.xml

rsync

Copy source to destination.

rsync -avP –stats [source] [destination]

both `[source]` and `[destination]` can be like the following formats:

[user_name]@[host_name]:[host_folder]

The following example copies a local folder `c:fenton_dir` to a remote server `spicevan.com`, logging in as the `root` user. The files get copied to the directory: `/home/ftravers/backupdir`

rsync -avP –stats c:\fenton_dir root@spicevan.com:/home/ftravers/backupdir

The beauties of rsync are:

  • it will pick up where it left off. Good for big files and slow network links.
  • if you change a large file and re-run rsync it will not transfer the whole file only the sections of the file that have changed
  • you can use it on a whole directory structure and it will only send the files that have changed.
  • … and a whole lot of other more technical details that I won’t bother getting into here…

Environment Variables

Edit the file:

debian linux: `~/.bashrc` red hat: `~/.bash_profile`

set an environment variable like the following:

export [variable_name]=[variable_value]

The example below sets two environment variables: `PATH` and `JAVA_HOME`. Notice with the `PATH` example I reuse the existing value of the `PATH` variable to extend it. This way I’m adding to the path not replacing it.

export PATH=$PATH:/home/ft/bin/apache-maven-2.2.1/bin:/home/ft/bin/jdk1.6.0_18/bin export JAVA_HOME=/home/ft/bin/jdk1.6.0_18

  • Global Environment Variables

On debian linux: `/etc/bash.bashrc`

On redhat linux: `/etc/profile`

Also there is the file: `/etc/environment`, which may have some values…

Unset

unset <variable> unset http_proxy

Aliasing

Put in:

~/.bashrc

or

~/.bash_aliases

Alias format:

alias [new_short_name]=’[long_painful_to_type_command]’

example:

alias vms=’ssh root@vms.lab.com’

Misc Commands

wget recursively

wget -r -np -c -U “Mozilla/5.0 (X11; U; Linux i686; nl; rv:1.7.3) Gecko/20040916” -e robots=off http://voxel.dl.sourceforge.net/proj…_linux.tar.bz2

Grep

Remove found files with either the png or the jpg string in them…the trick is the | part.

find . | grep -v “png|jpg”

Search recursively in current directory on down for files ending in *.java for string Wiki

grep -R Wiki –include “*.java” .

Linking

Create a soft link:

ln -s <existing_file> <new_link_name>

Date / Time

hwclock –set –date=’08/18/07 14:40:40’ –localtime

CPU info, Distro info

Distro Info

rpm variants:

cat /etc/*release

ubunut

cat /etc/debian_version cat /etc/lsb-release

other

cat /etc/*version

CPU Info

cat /proc/cpuinfo

ref: [http://www.brunolinux.com/05-Configuring_Your_System/CPU_Info.html](http://www.brunolinux.com/05-Configuring_Your_System/CPU_Info.html)

NFS

Server

On exporting server, `/etc/exports`, the format of the entry is:

<share_folder> <authorized_hosts_list> <share_settings>

example:

/OVS/sharedDisk * (rw,sync,all_squash,anonuid=500,anongid=500)

[root@vl-vmsrv2 jeos]# service nfs restart

The following is how to mount another machines NFS exports:

Client

:

[root@vl-vmsrv2 ~]# cat /etc/fstab jpbox:/u01/Shared /mount/jpbox nfs defaults 0 0 [root@vl-vmsrv2 ~]# mount -a

Compiz Settings

Add the following:

  • - (Add) Effects > Wobbly Windows
  • - (Remove) Desktop > Viewport Switcher
  • - (Edit) Desktop > Expo
    • Bindings
      • Expo Button = Ctrl – Button5
      • Drag&Drop = Ctrl – Button1
      • Exit Expo = Ctrl – Button4
    • Appearance

Viewport Distance = .15 Hide panels/docs in expo = checked Mipmaps = checked Brightness = 71 Saturation = 62

  • - (Edit) Desktop > Desktop Wall
    • Viewport Switch Preview

Preview Scale = 100 Background Gradient = All Black Others = All white

  • - - Bindings

Move Up/Down/Next/Prev = Ctrl - [direction arrow]

  • - (Edit) Window Management > Grid

Remove Alt from all key bindings

  • - (Remove) Static Application Switcher
  • - (Add) Application Switcher
    • Next Window = Ctrl-Super-KPRight
    • Prev Window = Ctrl-Super-KPLeft
  • - (Add) Shift Switcher (resolve conflict by setting dont set terminiate)
    • Bindings
      • Next Window = Alt-Tab
      • Prev Window = Alt-Shift-Tab
  • - (Edit) Scale
    • Bindings
      • Initiate Window Picker = Super-KP5(begin)
      • Initiate Window Picker for all Windows = Ctrl-Super-KP5(begin)

    oracle@oracle-laptop:~/projects/myConfig$ cat SQLDeveloper.desktop [Desktop Entry] Name=SQL Developer Comment=SQL Developer Program Exec=/bin/sh /home/oracle/bin/sqldeveloper/sqldeveloper.sh Icon=/home/oracle/bin/sqldeveloper/icon.png Type=Application Categories=Development;Database; Path=/home/oracle/bin/sqldeveloper/

    [Desktop Entry] Name=Eclipse - Helios Comment=Eclipse - Helios, IDE Exec=/home/ftravers/bin/eclipse_3.6.1/eclipse Icon=/home/ftravers/bin/eclipse_3.6.1/icon.xpm Type=Application Categories=Development;IDE; Path=/home/ftravers/bin/eclipse_3.6.1/

screen

To keep a shell session on a remote server in its state, there is a little utility that can do that for you. It can be useful to let a long script running like an rsync backup over the network. A session of screen can also be “detached” and used by another user, making it easy to collaborate on a project.

To install screen (as root):

yum -y install screen

Create Session

Then you can just start a screen session:

screen -S MyTitle

Detach

To exit this session and go back to the regular shell press ctrl+a then d ctrl+a then k will kill the session.

List

To list the active screen sessions:

screen -ls

to reattach a screen, use `screen -r` if there is only one session open. If there are more, use `screen -r NNNN.SessionTitle`

Detach Attached Screeen

If a screen is attached and you want to detach it manually from outside of it do:

screen -D <screen-session-name>

Linux Commands / Cookbooks

Determine what process listens on a port

Install lsof, and see whats listening on port 80.

“`bash $ sudo apt-get install -y lsof $ lsof -i :80 “`

Redhat derivatives

rpm

For installing a software package, you use the rpm command with -i option (which stands for “install”). For example, to install an RPM package called software-2.3.4.rpm:

accelerated web downloads

There is a nice utility `aget` that you can install on Redhat distributions. Add the following to: `/etc/yum.repos.d/dries.repo`:

[dries] name=dries enabled=1 gpgcheck=1 gpgkey=http://dries.ulyssis.org/rpm/RPM-GPG-KEY.dries.txt baseurl=http://ftp.belnet.be/packages/dries.ulyssis.org/redhat/el5/en/i386/dries/RPMS

you may need to also do:

wget http://dries.ulyssis.org/rpm/RPM-GPG-KEY.dries.txt rpm –import RPM-GPG-KEY.dries.txt

if you need a proxy for your wget use something like:

export http_proxy=http://your.proxy.server:port && wget -c http://whatever

but I think the dries.repo entries should take care of that.

Then just do:

yum install aget

Run aget to see how it is used:

usage: aget [options] url options: -p port number -l local file name -n suggested number of threads -f force using suggested number of threads -h this screen -v version info http//www.enderunix.org/aget/

less

Key StrokeEffect
------------------------------------------

G | go to end of file f | scroll forward one screen b | scroll backwards one screen

bzip

Unzip tar bzipped file:

tar xvfj thunderbird-10.0.tar.bz2

grep

To get context (i.e. lines before and after a grep hit) use -A and -B flags. The following retrieves 3 lines *B*efore and *A*fter a hit:

grep -A 3 -B 3 fenton *

nmap

<a name=”portScan”>check to see if a port is open on a machine</a>

<pre><div class=”sample_code”>nmap -PN -p <span class=”parameter”>PORT SERVER</span></div></pre>

To see if port 80 is open on 143.234.11.34 do:

nmap -PN -p 80 143.234.11.34

check if any machine on local network has port 22 open

nmap -p22 192.168.0.0/24

-p22only port 22
-vverbose
192.168.0network (255 hosts)

nohup

send nohup output to a filename of your choice:

nohup execute receiptLoaderStart > nohup_sumarylogfile 2>&1 &

wget

Sample getting a file with username/password

“`bash $ wget –http-user=ftravers –http-password=PASSWORD http://files.spicevan.com/share/4G1Gswp.tgz

$ wget –load-cookies=cookies.txt -O myfile.tgz “https://edelivery.oracle.com/EPD/Download/process_download/V28080-01.zip?file_id=43691715&aru=14104967&userid=890087&egroup_aru_number=10783547&country_id=36&patch_file=V28080-01.zip” “` https://edelivery.oracle.com/EPD/Download/process_download/V28080-01.zip?file_id=43691715&aru=14104967&userid=890087&egroup_aru_number=10783547&country_id=36&patch_file=V28080-01.zip

cadaver

command line put/get (like ftp) access for webdav servers (i.e. over http)

cadaver –proxy=www-proxy.us.oracle.com:80 http://files.spicevan.com/share

use put/get to transfer files.

tree

Do a tree listing, only show files that begin with `application`.

tree -P “application.*”

keytool

A keystore is a password-protected file which stores the keys and certificates. The keytool application can import, export and list the contents of a keystore. The keytool can also be used to generate self-signed certificates for test purposes.

The keytool use as default a keystore file `.keystore` which is located in your home directory or profile directory. To use another keystore file use the `-keystore` flag. To list the content of a keystore, type: `keytool -list`

When referring to a particular entity in the keystore use the `-alias` flag.

Certificates generated by the system will be valid for just under one year by default. To change the length of validity for a certificate to n days, add the flag `-validity`

These commands allow you to generate a new Java Keytool keystore file, create a CSR, and import certificates. Any root or intermediate certificates will need to be imported before importing the primary certificate for your domain.

Notes on flags

-alias

This is just a nickname for the key, can be anything (I think?)

Creating and Importing

Generate a Java keystore and key pair

keytool -genkey -alias mydomain -keyalg RSA -keystore keystore.jks -keysize 2048

Generate a certificate signing request (CSR) for an existing Java keystore

keytool -certreq -alias mydomain -keystore keystore.jks -file mydomain.csr

Import a root or intermediate CA certificate to an existing Java keystore

keytool -import -trustcacerts -alias root -file Thawte.crt -keystore keystore.jks

Import a signed primary certificate to an existing Java keystore

keytool -import -trustcacerts -alias mydomain -file mydomain.crt -keystore keystore.jks

Generate a keystore and self-signed certificate (see [How to Create a Self Signed Certificate using Java Keytool](http://www.sslshopper.com/article-how-to-create-a-self-signed-certificate-using-java-keytool.html) for more info)

keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore.jks -storepass password -validity 360 -keysize 2048

Checking

If you need to check the information within a certificate, or Java keystore, use these commands.

Check a stand-alone certificate

keytool -printcert -v -file mydomain.crt

Check which certificates are in a Java keystore

keytool -list -v -keystore keystore.jks

Check a particular keystore entry using an alias

keytool -list -v -keystore keystore.jks -alias mydomain

Other

Delete a certificate from a Java Keytool keystore

keytool -delete -alias mydomain -keystore keystore.jks

Change a Java keystore password

keytool -storepasswd -new new_storepass -keystore keystore.jks

Export a certificate from a keystore

keytool -export -alias mydomain -file mydomain.crt -keystore keystore.jks

List Trusted CA Certs

keytool -list -v -keystore $JAVA_HOME/jre/lib/security/cacerts

Import New CA into Trusted Certs

keytool -import -trustcacerts -file /path/to/ca/ca.pem -alias CA_ALIAS -keystore $JAVA_HOME/jre/lib/security/cacerts

If you need to move a certificate from Java Keytool to Apache or another type of system, check out these instructions for [converting a Java Keytool keystore using OpenSSL](http://www.sslshopper.com/article-move-your-java-keytool-ssl-certificate-to-openssl.html). For more information, check out the [Java Keytool documentation](http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/keytool.html) or check out our [Tomcat SSL Installation Instructions which use Java Keytool](http://www.sslshopper.com/tomcat-ssl-installation-instructions.html).

Screen Resolutions

CTRL-ALT-F1 -> F6 give you 6 tty terminals. CTRL-ATL-F7 will give you the GUI terminal (i.e. take you back).

Start and stop X:

sudo /etc/init.d/gdm stop

Getting Modeline

want 1920x1080 (HD) resolution.

gtf 1920 1080 60

or

cvt 1920 1080

Example:

$ cvt 1920 1080

Modeline “1920x1080_60.00” 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync

$ xrandr –newmode “1920x1080_60.00” 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync

Toggle between two resolutions

$ xrandr –output DFP1 –mode 1600x900 $ xrandr –output DFP1 –mode 1600x1200

Samsung 23”

For xrandr use DFP1 for the ‘output’ parameters.

Section “Monitor” Identifier “aticonfig-Monitor[0]-0” Option “VendorName” “ATI Proprietary Driver” Option “ModelName” “Generic Autodetecting Monitor” Option “DPMS” “true” EndSection

Section “Screen” Identifier “aticonfig-Screen[0]-0” Device “aticonfig-Device[0]-0” Monitor “aticonfig-Monitor[0]-0” DefaultDepth 24 SubSection “Display” Viewport 0 0 Depth 24 Modes “1920x1080” Virtual 2944 1080 EndSubSection EndSection

Section “ServerLayout” Identifier “aticonfig Layout” Screen 0 “aticonfig-Screen[0]-0” 0 0 EndSection

Section “Device” Identifier “aticonfig-Device[0]-0” Driver “fglrx” BusID “PCI:0:1:0” EndSection

awk

“`bash $ ls ~/projects/documentation/*.textile /home/fenton/projects/documentation/dia.textile /home/fenton/projects/documentation/java.textile /home/fenton/projects/documentation/secure.textile home/fenton/projects/documentation/virtualMachines.textile $ ls ~/projects/documentation/*.textile | awk -F”” ‘{print $(NF)}’ dia.textile java.textile secure.textile virtualMachines.textile

Here `-F` means this is the field delimiter, and $(NF), where NF is a special variable that holds the number of fields.

Fetchmail

First you need to setup an SMTP server

$ sudo aptitude install postfix

Simply accept the defaults when the installation process asks questions. Stop Postfix:

“` bash $ sudo /etc/init.d/postfix stop $ tail -14 /etc/postfix/main.cf ########################################## ##### non debconf entries start here ##### ##### client TLS parameters ##### smtp_tls_loglevel=1 smtp_tls_security_level=encrypt smtp_sasl_auth_enable=yes smtp_sasl_password_maps=hash:/etc/postfix/sasl/passwd smtp_sasl_security_options = noanonymous ##### map jane@localhost to jane.doe@gmail.com ##### smtp_generic_maps=hash:/etc/postfix/generic relayhost=[stbeehive.oracle.com]:587

$ tail /etc/postfix/generic fenton@localhost fenton.travers@oracle.com

$ cd /etc/postfix; sudo postmap generic $ cat /etc/postfix/sasl/passwd [stbeehive.oracle.com]:587 fenton.travers@oracle.com:SuPeRsEcReT “` cd /etc/postfix/sasl; sudo postmap passwd; sudo chown root.root passwd passwd.db; sudo chmod 600 passwd passwd.db

sudo /etc/init.d/fetchmail stop; sudo /etc/init.d/postfix stop sudo /etc/init.d/postfix start; sudo /etc/init.d/fetchmail start

“`bash $ tail -2 /etc/default/fetchmail

START_DAEMON=yes $ cat /etc/fetchmailrc

set daemon 300 # Pool every 5 minutes set syslog # log through syslog facility set postmaster root set no bouncemail # avoid loss on 4xx errors

defaults: timeout 300 antispam -1 batchlimit 1000 poll stbeehive.oracle.com protocol imap user “fenton.travers@oracle.com” there with password “Password” is fenton here keep $ sudo chown fetchmail ./fetchmailrc $ sudo chmod 600 fetchmailrc $ grep START_DAEMON /etc/init.d/fetchmail START_DAEMON=”yes” $ sudo /etc/init.d/fetchmail start “`

## Wanderlust - Emacs Mail Client

“`bash $ cat ~/.folders .INBOX “Inbox” “`

Startup Script:

“` #! /bin/sh ### BEGIN INIT INFO

### END INIT INFO PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/nginx/sbin DAEMON=/opt/nginx/sbin/nginx NAME=nginx DESC=nginx test -x $DAEMON || exit 0

if [ -f /etc/default/nginx ] ; then . /etc/default/nginx fi set -e case “$1” in start) echo -n “Starting $DESC: ” start-stop-daemon –start –quiet –pidfile /opt/nginx/logs/$NAME.pid –exec $DAEMON – $DAEMON_OPTS echo “$NAME.” ;; stop) echo -n “Stopping $DESC: ” start-stop-daemon –stop –quiet –pidfile /opt/nginx/logs/$NAME.pid –exec $DAEMON echo “$NAME.” ;; restart|force-reload) echo -n “Restarting $DESC: ” start-stop-daemon –stop –quiet –pidfile \ /opt/nginx/logs/$NAME.pid –exec $DAEMON sleep 1 start-stop-daemon –start –quiet –pidfile \ /opt/nginx/logs/$NAME.pid –exec $DAEMON – $DAEMON_OPTS echo “$NAME.” ;; reload) echo -n “Reloading $DESC configuration: ” start-stop-daemon –stop –signal HUP –quiet –pidfile /opt/nginx/logs/$NAME.pid \ –exec $DAEMON echo “$NAME.” ;; *) N=/etc/init.d/$NAME echo “Usage: $N {start|stop|restart|force-reload}” >&2 exit 1 ;; esac

exit 0 “`

Fire it up

“`bash $ sudo chmod +x /etc/init.d/nginx $ sudo /usr/sbin/update-rc.d -f nginx defaults $ sudo /etc/init.d/nginx start “`

rc files read

Login

.bash_profile (only calls .bashrc) .profile

non-login & interactive

Non-login means when you just statup a terminal locally. .bashrc

Printer

╭─fenton@archlinux ~ ‹master*› ╰─➤ lp lawyer-annie-letter.txt lp: Error - No default printer. ╭─fenton@archlinux ~ ‹master*› ╰─➤ lpstat -p -d 1 ↵ printer Brother_HL-L2320D_series is idle. enabled since Sun 28 Oct 2018 11:08:03 AM PDT no system default destination ╭─fenton@archlinux ~ ‹master*› ╰─➤ lpoptions -d Brother_HL-L2320D_series copies=1 device-uri=usb://Brother/HL-L2320D%20series?serial=U63877F7N819431 finishings=3 job-cancel-after=10800 job-hold-until=no-hold job-priority=50 job-sheets=none,none marker-change-time=0 number-up=1 printer-commands=AutoConfigure,Clean,PrintSelfTestPage printer-info=’Brother HL-L2320D series’ printer-is-accepting-jobs=true printer-is-shared=false printer-is-temporary=false printer-location printer-make-and-model=’Brother HL-L2340D for CUPS ’ printer-state=3 printer-state-change-time=1540750083 printer-state-reasons=none printer-type=10522644 printer-uri-supported=ipp://localhost/printers/Brother_HL-L2320D_series ╭─fenton@archlinux ~ ‹master*› ╰─➤ lpq Brother_HL-L2320D_series is ready no entries ╭─fenton@archlinux ~ ‹master*› ╰─➤ lp lawyer-annie-letter.txt request id is Brother_HL-L2320D_series-13 (1 file(s))