Posts in Category: Linux

Linux commandline 

Categories: Linux


  • clear : empty console
  • ls -soah : show file details
  • cat filename : show content inline
  • less filename : show content in scrollable way
  • rm -I glob : remove but confirm once
  • mkdir -p : create new folder, ignore if exits
  • top : show processes
  • htop : show processes with colors
  • pstree -p : show which process contains what other process by id
  • kill processid : terminate process
  • df -h : show diskspace
  • reboot : restart the system
  • lsof -i : list open ipv[46] files by process
  • netstat -tulpn : display listening sockets
  • nmap -v : find open ports on gateway
  • nc : networking tool - see https://en.wikipedia.org/wiki/Netcat
  • dmesg | grep -iC 3 "search item" : find in debug messages
  • curl -L ken.be : show website content inline and follow redirects
  • who : currently logged in users
  • whoami : user that run this command
  • passwd -Sa : show status of all accounts
  • groupadd groupname : create new group
  • useradd -m -g groupname username : create home, add user and assign group 
  • find / -group groupname : find files owned by group
  • find / -user username : find files owned by user
  • stat -c %U /var/motion/cam1 : show who ownes the folder
  • sudo -u username somecommand : elevate permissions for command
  • chown video:video /var/whatever : change file ownership
  • chmod 755 /var/whatever : change file permissions
  • chmod +x script.sh : add execute permissions to script file


Categories: Linux

vi editor commands

  • [ins] edit text
  • [esc] return back from editing
  • :w save
  • :wq save and exit
  • ? search
  • :q! exit without saving
  • a number preceding any vi command tells vi to repeat that command that many times.

cursor movement

  • h move left (backspace)
  • j move down
  • k move up
  • l move right (spacebar)
  • [ret] move to the beginning of the next line
  • $ last column on the current line
  • 0 move cursor to the first column on the current line
  • ^ move cursor to first nonblank column on the current line
  • w move to the beginning of the next word or punctuation mark
  • W move past the next space
  • b move to the beginning of the previous word or punctuation mark
  • B move to the beginning of the previous word, ignores punctuation
  • e end of next word or punctuation mark
  • E end of next word, ignoring punctuation
  • H move cursor to the top of the screen 
  • M move cursor to the middle of the screen
  • L move cursor to the bottom of the screen

screen movement

  • G move to the last line in the file
  • xG move to line x
  • z+ move current line to top of screen
  • z move current line to the middle of screen
  • z- move current line to the bottom of screen
  • ^F move forward one screen
  • ^B move backward one line
  • ^D move forward one half screen
  • ^U move backward one half screen
  • ^R redraw screen 
  • ^L redraw screen


  • r replace character under cursor with next character typed
  • R keep replacing character until [esc] is hit
  • i insert before cursor
  • a append after cursor
  • A append at end of line
  • O open line above cursor and enter append mode


  • x delete character under cursor
  • dd delete line under cursor
  • dw delete word under cursor
  • db delete word before cursor

copying code

  • yy (yank)'copies' line which may then be put by the p(put) command. Precede with a count for multiple lines.

put (brings back previous deletion or yank of lines, words, or characters)

  • P bring back before cursor
  • p bring back after cursor

find commands

  • ? finds a word going backwards
  • / finds a word going forwards
  • f finds a character on the line under the cursor going forward
  • F finds a character on the line under the cursor going backwards
  • t find a character on the current line going forward and stop one character before it
  • T find a character on the current line going backward and stop one character before it
  • ; repeat last f, F, t, T

miscellaneous commands

  • . repeat last command
  • u undoes last command issued
  • U undoes all commands on one line
  • xp deletes first character and inserts after second (swap)
  • J join current line with the next line
  • ^G display current line number
  • % if at one parenthesis, will jump to its mate
  • mx mark current line with character x
  • 'x find line marked with character x

line editor mode

  • any commands form the line editor ex can be issued upon entering line mode.
  • to enter: type ':'
  • to exit: press[return] or [esc]


  • :# move to line #
  • :$ move to last line of file


  • :!'cmd' executes 'cmd' as a shell command.

Remove or hide old linux kernel versions from boot menu 

Categories: Linux

Open terminal, check your current kernel

uname -r

List all the kernels

dpkg --list | grep linux-image

Remove the ones you don't need (do not delete the current kernel)

sudo apt-get purge linux-image-x.x-x-686-pae

Done, but sometimes you need to update grub with: sudo update-grub2

Asus eee PC as router 

Categories: Linux Network

A white Asus eee PCBurning linux penguin

I still had a small Asus eee Pc, so I decided to turn it into a router I can take with when I travel. I could have installed a full distro on it, but decided to go for one of the prebuild firewall distros. I installed monowall and saw that it was actually not really using the little pc, so I replaced it with ipfire because it allows you install additional packages for file and printer sharing and you switch samba on if needed.

Since the Asus eee Pc has only one wired nic and one wireless adapter, there are some little tricks to remember...

  • Download ipfire cd-rom iso and use Yumi to put it on a usb stick.
  • Press escape on boot to select usb.
  • Internet modem cable goes into red.
  • Wifi will become green. (as opposed to the usual blue)
  • After reboot login to shell as root
  • ifconfig (to check if you got ip from isp)
  • pakfire list (will show all the addons available for ipfire)
  • pakfire install hostapd (turns wifi adaptor into access point)
  • pakfire install elinks
  • elinks (use elinks at to configure wifi)

The tricky part is using elinks text browser, it feels so 1985. Remeber that after selecting the information is at the bottom of the console. You also have to press enter to type into an input field, but should use the arrows to exit the field.

After you enable the wifi (menu > ipfire > WLanAP), you could use the default ssid (ipfire) and password (IPFire-v2.x) to re-configure on another client with the web interface.

other links:

Puppy Linux 

Categories: Linux

Drawing of dog with one black eye

Installation on old Acer Aspire

  • YUMI + lupu-528.005.iso
  • Install wifi through connect icon on desktop
  • Hostname: Acer-Puppy
  • Auto DHCP:
  • Control - Drive - Gparted - Create empty ext3 partion - Right click new partion - Manage Flags - check boot
  • Control - Install - GRUB
  • Install - Universal Installer - Internal IDE or SATA drive - Directory /mnt/sdb1/multiboot/puppy/lupu_528.sfs - Full
  • Copy GRUB menu option to /mnt/sda1/menu.lst
  • Redo the configuration but now for the harddisk version
  • Quickpet - Install Seamonkey 2.8 Lucid
  • Install - PPM - Use Ziggy
  • Add adblock+ for Seamonkey

Create folder share for Windows LAN

  • mkdir /srv/Downloads -p
  • chmod 1766 /srv/Downloads
  • touch /srv/Downloads/readme.txt
  • leafpad /srv/Downloads/readme.txt
  • cat /srv/Downloads/readme.txt
  • PPM - Search Samba - Install samba_full-3.6.1-s.pet from ibiblio.org
  • PPM - Install Transmission-2.31-i486-static - Preferences - Show tray icon - Use /svr/Downloads
  • Find Torrent - Right Click - Copy Link Location
  • Transmission - File - Open Url

Setup icons on desktop

  • /usr/share/application - drag application icon to desktop

Copy to pdf folder

  • home/my-documents/PDF (must be in uppercase)

Setup firewall to allow internal network

  • /etc/rc.d/rc.firewall - PERMIT = "" 

Update SAMBA configuration

  • find / -type f -name "*.conf"
  • /etc/samba/smb.conf
  • mv /etc/opt/samba/smb.conf /etc/opt/samba/smb.conf.1st.backup 
  • leafpad /etc/opt/samba/smb.conf
 # All SAMBA configurations have a global piece AND it has piece(s) called shares 
# Global Parameters describes this PC’s behavior, overall.
workgroup = KENSPLACE
server string = %h is a NAS (Test)
# Sharing Parameters tell what items this PC shares out to the LAN
path = /srv/Downloads
comment = A Central Download folder for all to use
writeable = true
guest ok = Yes

Setup Canoscan LiDE 30

  • PPM - xsane_0.996 - Install dependencies
  • Graphics - XSane Image Scanner