Linux notes (Ubuntu/Debian) Linux Notes

Installation

Download the Ubuntu .ISO CD image file and burn it to a CD or DVD.

Dual-boot setup

To dual-boot, install Windows, first; then, boot from the DVD to install Linux with a boot loader option.

File-searching … and indexing

searching via SearchMonkey

To find occurences of a $variableName, including the dollar-sign prefix, in the "Containing" text box, escape the dollar-sign, as in ... \$variableName.

FireFox

FireFox (3.5) still looks for a video plugin. Search "Synaptic Package Manager" for flash ... install flashplugin-installer . When you re-start FireFox, it will stop griping at you for video plugins.

Devices Setup

Scanner

The SANE (Scanner Access Now Easy) API provides a universal scanner-interface to raster image-scanner hardware.  Only one driver is needed per image acquisition device.

TWAIN does not separate user-interface from device driver, thus precluding network access and device sharing.

Not all scanners are supported, especially newer scanner models; check the SANE website before committing to a scanner.

MAKE ... from source code

make .load vs. make install (modprobe)

The first approach (make .load) does not check for dependencies; the second approach (make install; modprobe module) does check for dependencies.

Networking commands

To stop/start a network device:
  > sudo  /etc/init.d/networking restart
To check wireless configuration and speeds:
  > iwconfig

Security and Permissions

Succinct file Permissions explanations and examples for Ubuntu/Debian are at: File Permissions. User and Group Permissions reside in:
    /etc/group
    /etc/passwd
    /etc/shadow
When a system has 'shadow-passwords' enabled, the password field in /etc/passwd is replaced by an "x" and the user's real (encrypted) password is stored in /etc/shadow. For a quick view or check in the above,
    sudo cat /etc/passwd               ... or, to limit results to a single user
    cat /etc/passwd | grep userAccountName

sudo vs. gksudo

gksudo was designed to prevent home-directory files from root ownership by setting HOME=~root and copying .Xauthority to a tmp directory. Therefore, gksudo , rather than sudo, should be used to start gui applications.

users-admin

The Ubuntu/Debian users-admin applet only shows application-level Users. users-admin does not display service-level process User Permissions, like the Apache www-data User.
    sudo cat /etc/shadow
... will display service-level Users and Permissions.

folder Permissions terms

Octal Permissions

There are 8 (octal) Permissions combinations, as follows:

Octal value Binary value Permissions meaning
0 000 --- no Permissions
1 001 --X eXecute Permissions
2 010 -W- Write Permissions
3 011 -WX Write & eXecute Permissions
4 100 R-- Read Permissions
5 101 R-X Read & eXecute Permissions
6 110 RW- Read & Write Permissions
7 111 RWX Read, Write & eXecute Permissions
Permissions are applied to: owner:group:others. Permissions stay as set - even if the file or folder Owner or Group are, subsequently, changed! Syntax note: Permissions assignment categories are separated by colons. Note, also, that Permission octal values are cumulative e.g.
    1 (eXecute) + 2 (Write) = 3 (eXecute and Write)
    2 (Write)   + 4 (Read)  = 6 (Write and Read)
    1 (eXecute) + 4 (Read)  = 5 (eXecute and Read)
    1 (eXecute) + 2 (Write) + 4 (Read) = 7 (Read, Write and eXecute)

Printing

NetGear PS-110 parallel-port print server for HP4P LaserJet printer

NetGear advises PS-110 print server IP address via the NetGear Windows Administration-configuration tools.

Terminal Services

Terminal services clients may connect to a server via various communcation protocols. Telnet, which is insecure, has been supplanted by SSH (Secure Shell), which is more secure.
Acronym Protocol Considerations
RDP Reliable Data Protocol used in Microsoft Terminal Services
VNC Virtual Network Computing For PC’s with out X-windows
XDMCP X-windows Display Manager Control Protocol Insecure –  for LAN-use, only

Considerations/Implications

As of version 5.2, Microsoft’s RDP is now very competitive to Citrix’s ICA protocol.

VNC was developed by AT&T, Cambridge, England for PC’s without X-windows.  VNC is similar to Windows Terminal Services.  Traffic between the client and server is not encrypted; VNC traffic can be tunneled over IPsec.  VNC is now open-source.

PuTTY makes terminal services available over SSH (rather than Telnet).  PuTTY is free, open-source.

common, useful *nix Commands

See info coreutils for a comprehensive list and more detailed syntax or type man command at a shell for more information. Bracketed items are optional.

adduser to a User-Group
syntax adduser userName groupName
Explanation Unlike User Permission changes, Group changes require a logout/login re-cycle.
alias create an alias
syntax alias [name[=’value’]]
Example alias la=’ls -la --color=auto’
Explanation creates an alias for the ls command which displays a detailed list with various file types in different colors.
Windows equivalent N/A
cat display file contents
syntax cat [options] [file1] [file2] ...
Example cat index.html
Explanation displays the contents of the index.html file.
Windows equivalent type
cd change directory
syntax cd [-LP] [directory]
Example cd /usr/local/bin
Explanation changes the /usr/local/bin directory
Windows equivalent cd
chgrp change Group ownership
syntax chgrp [options] group file1 file2 ...
Example chgrp apache index.html
Explanation changes the group ownership of the index.html file to the apache group.
Windows equivalent N/A
chmod change (Permissions) mode
syntax chmod [options] mode[,mode] file1 [file2 ...]
to view current file Permissions ls -l file
Example syntax chmod user:group /path/to/file.ext
Example chmod 755 /path/to/script.cgi
Explanation changes the script.cgi Permissions so that everyone can eXecute (1) and Read (4) it. (1 + 4 = 5 ... in the 755) Separate user from group from others by colons.
Windows equivalent
chown change file owner and group
syntax chown [-R] [[user]][:group] targetFile [[targetDirectory ..]]
Example chown someUser:someGroup /fileName /directory/file2
Explanation changes the ownership of the index.html file to root.
Windows equivalent N/A
cmp character-by-character compare between two files
syntax cmp [options] from-file to-file
Example cmp index.html default.htm
Explanation compares each character in index.html and default.htm and displays the differences.
Windows equivalent
cp Copy one or more files to another location
syntax cp [options] source destination
Example cp index.html index.html.bak
Explanation makes a second copy of the index.html file in the same directory. The new copy has the .bak extension.
Windows equivalent copy
du Estimate file space usage
syntax du [options] [file]
Example du
Explanation displays the disk usage of the current directory.
Windows equivalent dir
df display free disk space
syntax df [options] [file]
Example df
Explanation displays the used and free disk space on all mounted filesystems.
Windows equivalent dir
echo displays a message on-screen
syntax echo [options] [string]
Example echo Hello World!
Explanation displays the Hello World! message on-screen.
Windows equivalent echo
env environment variables
syntax set or remove environment variables
syntax env [options] [name[=value]] [comand [args]]
returns env HOME=/home/username
Windows equivalent changes the HOME environment variable to /home/username.
exit exit the shell interface
syntax exit
Example exit
Explanation Exits from the current command shell.
Windows equivalent exit
free displays memory categories
syntax free [options]
Example free -s 5
Explanation displays total, free, used and cached memory
Windows equivalent mem
fsck file system (consistency) check and repair
syntax fsck [options] [filesystem]
Example fsck /dev/hda1
Explanation performs a filesystem check on the first partition of the primary master drive.
Windows equivalent chkdsk
grep search file(s) contents for lines that match a given pattern
syntax grep [options] string [file1] [file2] ...
Example grep "search string" /home/*
Explanation searches all files in /home for the occurence of the "search string"
Windows equivalent N/A
gzip compress or decompress named file(s)
syntax gzip [options] file
Example gzip index.html
Explanation compresses index.html into a file, named index.html.gz
Windows equivalent N/A
kill stops a process/daemon from running
syntax kill [options] pid
Example kill 1234
Explanation terminates the process with id 1234 . Use the ps command to identify a processes id number.
Windows equivalent kill
less display screen content - one screen at a time
syntax less [options]
Example cat index.html | less
Explanation displays the index.html file on-screen
Windows equivalent type fileName | more
lspci display PCI-device characteristics, like device chip sets
syntax lspci
Example sample output: 00:0a.0 Ethernet controller: Accton Technology Corporation EN-1216 Ethernet Adapter (rev 11)
Explanation NIC device brand and model names are not as important as the chipset name.
Windows equivalent
ln make links between files
syntax ln [options] target [linkname]
Example ln -s /var/www/html /home/user/website
Explanation creates a shortcut, named website from the user’s home directory to the /var/www/html directory.
Windows equivalent shortcut
locate find files
syntax locate [options] string
Example locate perl
Explanation searches filesystem databases for files, containing the term perl .
Windows equivalent dir /s
ls lists file information
syntax ls [options] [file/directory]
Example ls -la /var/www/html
Explanation lists files and directories, located in the /var/www/html directory.
Windows equivalent N/A
man Help manual
syntax man [options] [command]
Example man man
Explanation displays the manual/documentation for the man command.
Windows equivalent N/A
mkdir create new folder(s)
syntax mkdir [options] directory
Example mkdir html
Explanation creates a directory, named html under the current directory.
Windows equivalent md
mount Mount a file system
syntax mount [options] [device/directory]
Example mount cdrom
Explanation Mounts the CD-ROM drive.
Windows equivalent automatic
mv move or rename files or directories
syntax mv [options] source destination
Example mv index.html /var/www/html
Explanation moves the index.html file from the current directory to /var/www/html.
Windows equivalent move
nice set a command or job priority
syntax nice [options] [comand [args]]
Example nice -n 19 httpd
Explanation runs the httpd process with the lowest possible priority (-20 is the highest priority).
Windows equivalent N/A
passwd modify a user password
syntax passwd [options]
Example passwd
Explanation prompts you to change the password for the current user. It will prompt for the old password, first.
Windows equivalent N/A
ping sends an (e.g. IP) echo packet to a host
syntax ping [options] host
Example ping www.apcmag.com
Explanation Continually sends echo packets to the www.apcmag.com host.
Windows equivalent ping
ps displays process status
syntax ps [options]
Example ps -ef
Explanation lists running processes.
Windows equivalent mem
pwd displays the current working directory
syntax pwd [options]
Example pwd
Explanation displays the current working directory
Windows equivalent cd
rm removes/deletes files
syntax rm [options] file1 file2 ...
Example rm -rf /var/www/html
Explanation forces the removal of the /var/www/html directory and all files and subdirectories inside it.
Windows equivalent del
rmdir remove directory
syntax rmdir [options] directory1 directory2 ...
Example rmdir /var/www/html
Explanation removes the /var/www/html directory, if it’s empty.
Windows equivalent rd
shutdown shutsdown or restarts Linux
syntax shutdown [options] when [message]
Example shutdown -r 20:00
Explanation reboot the system at 8pm.
Windows equivalent shutdown
scp Secure CoPy
syntax - TO a remote host scp sourceFile user@host:directory/targetFile
syntax - FROM a remote host scp user@host:directory/sourceFile targetFile
Explanation a secure SCH-based FTP alternative for file transfers. SCH must be installed (i.e. is required) on both the sending and receiving host computers. scp can interactively request any required passwords. See sftp for more file-system capabilities.
sleep delay for a specified period
syntax sleep [number]
Example sleep 30
Explanation pauses for 30 seconds — useful in some scripts.
Windows equivalent sleep
su substitute-user identity
syntax su [options] [username [args]]
Example su
Explanation switches to the root super-user.
Windows equivalent su
tail output the last part of files
syntax tail [options] [file1] [file2] ...
Example tail /var/log/error.log
Explanation displays the last 10 error log lines.
Windows equivalent N/A
tar Tape ARchiver
syntax tar [options] file1 [file2] ...
Example tar - czvf archive.tar.gz /var/www/html
Explanation compresses the /var/www/html directory contents into a gzipped tarball, named archive.tar.gz.
Windows equivalent N/A
touch change file timestamps
syntax touch [options] file1 ...
Example touch /var/www/html/index.html
Explanation updates the /var/www/html/index.html timestamp or creates the file, if it doesn’t already exist.
Windows equivalent
top lists the top running processes
syntax top [options]
Example top
Explanation provides an automatically-updating list of the most CPU-intensive processes, running on the system.
Windows equivalent N/A
traceroute traces the route to some host
syntax traceroute [options] host [packetsize]
Example traceroute www.apcmag.com
Explanation lists routers (and IP addresses) that IP datagrams pass through en-route to the www.apcmag.com server.
Windows equivalent tracert
umount un-mount a storage device
syntax umount [options] [device/directory]
Example umount cdrom
Explanation un-mounts the CD-ROM drive.
Windows equivalent automatic
unalias remove an alias
syntax unalias [options] [name]
Example unalias la
Explanation removes the alias, named la
Windows equivalent N/A
uname print system information
syntax uname [options]
Example uname -a
Explanation prints machine and operating system information
Windows equivalent N/A
vrms display non-free and contrib programs, installed
syntax vrms
Explanation lists programs in the terminal. See vrms --help for options
Windows equivalent N/A
which locate a program file in the user’s path
syntax which [options] file ...
Example which perl
Explanation same as the locate command, except that it restricts the program file search to the user’s path.
Windows equivalent


Back Home