nm .m k[ U' mm n...... file reading
read a certain line, e.g. the 1st: perl -ne 'if(1..1) {print "1st line is $_"; last;}' filename (1..1 is a range) awk 'FNR == 1' filename sed -n '1p' filename "head -1 filename" to print that first line, but can't specify arbitrary lines from anywhere in the file comment? ubuntu aliases
in .bashrc uncomment: #if [ -f ~/.bash_aliases ]; then # . ~/.bash_aliases #fi create .bash_aliases format: alias ll='ls -l' source .bashrc to load the config http://www.arsgeek.com/?p=686 -- [search: ubuntu shell alias] RootSudo
https://help.ubuntu.com/community/RootSudo Example #2 sudo /etc/init.d/networking restart
rm /home/user/.{ICE,X}authority
sudo -i
sudo -i -u username Java on GNU/Linux
export CLASSPATH=.:~/src/java/example Apparently has to be export for compile to work with imports. Gnome Keyboard Configuration
http://ubuntuforums.org/showthread.php?t=300381 In order to make Win + D, R and E to work, first go to System -> Preferences -> Keyboard (as bodhi.zazen said). Then click the Layout Options tab and then Alt/Win key behavior. Select Super is mapped to Win-keys. Then go to System -> Preferences -> Keyboard Shortcuts and edit: Home folder Show the panel run application dialog Hide all windows and focus desktop ALT + arrow keys to switch workspaces settings saved in ~/.gconfd/saved_state Samba
Find Samba version? http://lists.samba.org/archive/samba/2001-January/023500.html smbd is on Fedora, but not on Ubuntu sudo apt-get install samba smbfs Setting up smbfs (3.0.22-1ubuntu4) ... Ubuntu: mount -t smbfs -o uid=scarpent,gid=scarpent,username=admin ... System/kernel version info:
Samba
http://www.nslu2-linux.org/wiki/HowTo/TroubleshootADriveMissingCondition Had the same problems as described in the first entry. The way I was able to unsling: NFS
The package nfs-utils is the package of utilities and configuration files to enable the kernel-mode NFS that is compiled into Unslung-able v3.16 and later. Be sure that you have the portmap ipkg installed. Then to use kernel-mode NFS, you first need to: ipkg remove nfs-server if you have been using NFS previously and it is installed. Then you can: ipkg install nfs-utils Change UID
find / -user uid# -print | xargs chown username Ubuntu VNC Server
http://ubuntuforums.org/showthread.php?t=122402 instructions a year old -- interface seems different in edgy comments on vnc server in edgy: http://ubuntuforums.org/showthread.php?p=2113441 http://grumpymole.blogspot.com/2007/02/edgy-and-feisty-vnc4server-still-not.html Updated instructions for Dapper (and Edgy): http://ubuntuforums.org/showpost.php?p=1103220&postcount=112 Please note, these steps are only what you want to do if you had your VNC setup working under 5.10 and then you upgraded to 6.06 and it doesn't work anymore. 1. Log in to GNOME. 2. Click "System" -> "Administration" -> "Login Window" 3. Enter your password if necessary. 4. Click the "Remote" tab. 5. Under the "Style:" drop down box, choose "Same as Local". 6. Click the "Configure XDMCP" button and make sure "Honor Indirect Requests" is set to what you want it to be set to. (According to original post -- should be disabled) 7. Click "close" twice. See if this does it for you. Good luck! Edit: Forgot to add that my VNC session doesn't seem to be resumable. I don't know if it's due to the Dapper upgrade or if I messed up somewhere else. Howto points here: http://easylinux.info/wiki/Ubuntu#How_to_add_extra_repositories But what is that all about? 2/13/07 -- ah -- System --> Administration --> Synaptic Package Manager Settings --> Repositories On system76 (Prometheus) --> All are enabled by default On ibm T23 (Mercury) --> Community (universe) and restricted (multiverse) not enabled (Which caused error when trying to install vnc4server via apt-get: E: Couldn't find package vnc4server) Let's try this, changing to use the downgraded edgy vnc4server: sudo apt-get install vnc4server/edgy xinetd Appears to have worked. sudo vncpasswd /root/.vncpasswd sudo vi /etc/xinetd.d/Xvnc instructions say: sudo gedit /etc/xinetd.d/Xvnc but I thought were supposed to use gksudo, but got funny message when tried that (ah: http://www.psychocats.net/ubuntu/graphicalsudo) service Xvnc { type = UNLISTED disable = no socket_type = stream protocol = tcp wait = yes user = root server = /usr/bin/Xvnc server_args = -inetd :1 -query localhost -geometry 1024x768 -depth 16 -once -fp /usr/share/fonts/X11/misc -DisconnectClients=0 -NeverShared passwordFile=/root/.vncpasswd port = 5901 } (Much later, found /usr/share/X11/fonts/misc should be /usr/share/fonts/X11/misc 5. Restart xinetd (usually there is no need to reboot, but occasionally it might be required) sudo /etc/init.d/xinetd stop sudo killall Xvnc sudo /etc/init.d/xinetd start That's it! To test that this is working first try to connect from the same machine (the machine we just set up the VNC server on): vncviewer localhost:1 scarpent@prometheus:~$ vncviewer localhost:1 VNC viewer version 3.3.7 - built Jul 4 2006 10:04:48 Copyright (C) 2002-2003 RealVNC Ltd. Copyright (C) 1994-2000 AT&T Laboratories Cambridge. See http://www.realvnc.com for information on VNC. ReadFromRFBServer: rdr::SystemException: read: Connection reset by peer (104) After you've restarted the xinetd as shown in the step 5, you can check that xinetd is listening on port 5901 by doing this: sudo netstat -tap | grep xinetd And you should see a line like this: (your process ID doesn't have to be the same as mine 10932) tcp 0 0 *:5901 *:* LISTEN 10932/xinetd (not getting anything from netstat...) Rebooting results in netstat returning: tcp 0 0 *:5901 *:* LISTEN 4268/xinetd But still connection reset by peer... grep xinetd /var/log/syslog see: ubuntu xinetd[4829]: warning: can't get client address: Transport endpoint is not connected ubuntu xinetd[4830]: warning: can't get client address: Transport endpoint is not connected ubuntu xinetd[4268]: Deactivating service Xvnc due to excessive incoming connections. Restarting in 10 seconds. ubuntu xinetd[4268]: Activating service Xvnc ps -ef | grep Xvnc Doesn't show anything -- Xvnc is not running http://ubuntuforums.org/showpost.php?p=688683&postcount=12 If it doesn't work it means that Xvnc wasn't started. So in that case I would suggest to try starting Xvnc manually (not from within xinetd) just to make sure it can run at all (we will use screen :2 so it doesn't overlap with the original Xvnc): sudo Xvnc :2 -query localhost -geometry 1280x960 -depth 16 -once -fp /usr/share/fonts/X11/misc -DisconnectClients=0 -NeverShared passwordFile=/root/.vncpasswd (Later: again fixed fonts dir location) Now, from another terminal try to connect: vncviewer localhost:2 (orig. instruction had 1280x1024) Got this when trying to start Xvnc: Xvnc Free Edition 4.1.1 Copyright (C) 2002-2005 RealVNC Ltd. See http://www.realvnc.com for information on VNC. Underlying X server release 70000000, The X.Org Foundation Thu Feb 8 10:30:38 2007 vncext: VNC extension running! vncext: Listening for VNC connections on port 5902 vncext: created VNC server for screen 0 error opening security policy file /etc/X11/xserver/SecurityPolicy Could not init font path element /usr/share/X11/fonts/misc, removing from list! Fatal server error: could not open default font 'fixed' Trying: sudo /usr/bin/Xvnc :2 -query localhost -geometry 1280x960 -depth 16 -once -fp /usr/share/X11/fonts/misc -dontdisconnect -nevershared -rfbauth /root/.vncpasswd As suggested for an older vncviewer did not work either -- incorrect option Some stuff about xdmcp here: http://ubuntuforums.org/showpost.php?p=1010469&postcount=99 gdm needs to be running, and xdmcp also needs to be enabled. To start gdm use the following command on the machine you are trying to remote to ( this assumes you can either physically access it, or you have already "ssh"ed in Terminal) sudo /etc/init.d/gdm start (you might then need to wait a minute, depending on the speed on your machine) Next ensure that XDMCP is enabled sudo gedit /etc/X11/gdm/gdm.conf or sudo nano /etc/X11/gdm/gdm.conf (if doing this through Terminal) and find the [xdmcp] section at the end of the file change Enabled=False to Enabled=True Then save and then best to reboot. of course if gdm is not loaded on boot, you will have to start it again But the file warns about security of enabling this. http://ubuntuforums.org/showpost.php?p=1108781&postcount=117 1. Enable XDMCP Code: sudo gedit /etc/gdm/gdm.conf then find this rule: # The greeter for xdmcp logins, usually you want a less graphically intensive # greeter here so it's better to leave this with gdmlogin # RemoteGreeter=/usr/lib/gdm/gdmlogin remove the '#' in the last line so there should be: # The greeter for xdmcp logins, usually you want a less graphically intensive # greeter here so it's better to leave this with gdmlogin RemoteGreeter=/usr/lib/gdm/gdmlogin From this: http://ubuntuforums.org/showpost.php?p=1508871&postcount=153 Got the idea that I might remove vnc4server/edgy and install vnc4server Tried it, still get connection reset Probably because xdmcp is not enabled This: http://ubuntuforums.org/showpost.php?p=1630733&postcount=166 I just wanted to post and update to this thread for anyone experiencing problems with Edgy (and maybe Beryl? not sure if thats what hosed me) setting this up. In the /etc/xinetd.d/Xvnc file change -fp /usr/share/X11/fonts/misc TO -fp /usr/share/fonts/X11/misc This was my findings after ~2 hours of working away between x11vnc and vnc4server. (seems to related to fonts error seen earlier) yes! That was wrong for Edgy Restarted initd stuff but still couldn't grep for Xvnc. Tried the manual Xvnc start and got: scarpent@prometheus:~$ sudo Xvnc :2 -query localhost -geometry 1280x960 -depth 16 -once -fp /usr/share/fonts/X11/misc -DisconnectClients=0 -NeverShared passwordFile=/root/.vncpasswd Xvnc Free Edition 4.1.1 Copyright (C) 2002-2005 RealVNC Ltd. See http://www.realvnc.com for information on VNC. Underlying X server release 70000000, The X.Org Foundation Thu Feb 8 11:17:35 2007 vncext: VNC extension running! vncext: Listening for VNC connections on port 5902 vncext: created VNC server for screen 0 error opening security policy file /etc/X11/xserver/SecurityPolicy FreeFontPath: FPE "/usr/share/fonts/X11/misc" refcount is 2, should be 1; fixing. vncviewer localhost:1 now prompts for password but then ReadFromRFBServer: rdr::EndOfStream vncviewer localhost:2 vncviewer: ConnectToTcpAddr: connect: Connection refused Unable to connect to VNC server Let's enable xdmcp... sudo vi /etc/X11/gdm/gdm.conf Made: [xdcmp] Enabled=True And uncommented RemoteGreeter line Rebooted still can't see Xvnc in grep Still end of stream in vncviewer localhost:1 Try with Windows vncviewer and get password prompt, but then connection closed (192.168.1.106::5901) Still with end of stream errors. http://ubuntuforums.org/showpost.php?p=1993196&postcount=208 Try without the query localhost: sudo Xvnc :2 -geometry 1280x960 -depth 16 -once -fp /usr/share/fonts/X11/misc -DisconnectClients=0 -NeverShared passwordFile=/root/.vncpasswd Xvnc Free Edition 4.1.1 Copyright (C) 2002-2005 RealVNC Ltd. See http://www.realvnc.com for information on VNC. Underlying X server release 70000000, The X.Org Foundation Thu Feb 8 11:44:24 2007 vncext: VNC extension running! vncext: Listening for VNC connections on port 5902 vncext: created VNC server for screen 0 error opening security policy file /etc/X11/xserver/SecurityPolicy scarpent@prometheus:~$ sudo apt-get install vnc4server/edgy Reading package lists... Done Building dependency tree Reading state information... Done Selected version 4.1.1+xorg1.0.2-0ubuntu1 (Ubuntu:6.10/edgy) for vnc4server Suggested packages: vnc-java The following packages will be DOWNGRADED: vnc4server 0 upgraded, 0 newly installed, 1 downgraded, 0 to remove and 3 not upgraded. Need to get 0B/1011kB of archives. After unpacking 81.9kB disk space will be freed. Do you want to continue [Y/n]? Y dpkg - warning: downgrading vnc4server from 4.1.1+xorg1.0.2-0ubuntu1.6.10.1 to 4.1.1+xorg1.0.2-0ubuntu1. (Reading database ... 98245 files and directories currently installed.) Preparing to replace vnc4server 4.1.1+xorg1.0.2-0ubuntu1.6.10.1 (using .../vnc4server_4.1.1+xorg1.0.2-0ubuntu1_i386.deb) ... Unpacking replacement vnc4server ... Setting up vnc4server (4.1.1+xorg1.0.2-0ubuntu1) ... After downgrading, at at last, vncviewer localhost:1 works. Got an error of some sort, and a warning that I was already logged in. Let's try from Windows: Yes! Allows me to resume session also. Can't seem to share Firefox when running :0 and :1 (Same as in Fedora) Display looks ok -- but terminal window font not as good as direct login vncviewer from Fedora also works fine Was getting some crash when logging in :1 when already in :0, but not when logged out of :0. Possible issue: Was logged out of :0 Logged in and then out of :1 Display hosed on :0 -- bands of black and white and pixels Remote :1 still worked -- eventually used "sudo shutdown -r now" Couldn't reproduce it right away after restart And I followed that whole discussion, never realizing or thinking about the fact that my system76 is an AMD64. bash
echo $SHELL echo $BASH_VERSION exit/logout/CTRL+D ~scarpent/tmp = ~/tmp cd - <cd to previous dir> brace expansion: echo {b{ed,olt,ar}s = beds bolts bars echo {1..5} = 1 2 3 4 5 echo {a..c} = a b c echo b{ar{d,n,k},ed}s echo {a..z}{1..9} redirection command < filename command > filename cp equiv: $ cat < file1 > file2 quote single quote: echo 'first part '\'' second part first part ' second part stty -a (or stty all for solaris?) CTRL-C intr stop current command CTRL-D eof end of input CTRL-\ quit stop current cmd if CTRL-C doesn't work CTRL-S stop halt output to screen CTRL-Q restart output to screen DEL or CTRL-? erase erase last character CTRL-U kill erase entire command line CTRL-Z susp suspend current command ^S and ^Q more of a nuisance these days -- screen will appear to be stuck if inadvertently hit ^S. history editing /string search backward for string ??? CTRL+R seems to work ?string search forward for string ; redo last char-finding cmd , redo last char-find in opposite direction cmd complete ESC, * to expand in current command ESC, = to expand on different line can expand $ shell variables and ~, and @ (hostname) ~ invert case of current char (can use repeat count) # prepend # and send to history list Files .bash_profile default system profile is /etc/profile source or dot (., synonymous cmd) to execute commands in file .bashrc .bash_logout (could be clean-up, etc.) alias with no args lists all defined aliases unalias "name" removes alias def for name set / unset HISTTIMEFORMAT="%y/%m/%d %T " history PS1 shell prompt variable type <cmd> find out path to command hash -- shows hash table of cmd path lookups hash <cmd> -- force cmd to be added to hash CDPATH e.g. CDPATH=~/some_dir set cdable_vars sd=~/some_dir cd $sd or use shopt shopt -p list of settable options and current values -s sets each option name -u unsets each option name -q suppresses normal output - return status indicates if a variable is set or unset -o allows the values of the option names to be those defined for the -o option of the set command shopt -s cdable_vars cd sd export var=value to make available to subprocesses rc -- run commands (or so they say, from DEC operating systems) functions unset -f function_name declare -f prints names and defs declare -F just names Shell order of precedence 1. Aliases 2. Keywords (function, others) 3. Functions 4. Built-ins (cd, type) 5. Scripts and executable programs (PATH env var) type -all something list aliases, etc, defined for something positional parameters $* $@ all params $0 script name $# number of arguments $1 $2 $3 ... env var IFS (internal field separator) space TAB NEWLINE misc commands
stat -- info about files and dirs including links ssh server
ubuntu http://www.cyberciti.biz/tips/howot-install-ubuntu-linux-ssh-server.html sudo apt-get install openssh-server netstat -tulpn Ubuntu disk space usage
GUI: Applications --> Accessories --> Disk Usage Analyzer df standard file system disk usage discus |