Archives for posts with tag: tutorial

Although my friend insists Ruby is better, I feel Python was a good choice of language to learn over this summer. I do not yet feel comfortable enough with it to write formal tutorials, but I will provide links to the tutorials I have used thus far, to hopefully make it easier.

There are currently 2 versions of Python: version 2.x, and version 3.x. Version 3 is NOT backward compatible. Most of the world has not yet migrated from version 2.x, so I would learn version 2.x, then adjust to 3.x once more developers have formally adopted it.

Best tutorial for first learning:

http://docs.python.org/2.7/

Following this guide, all that remains is getting comfortable and familiar with various modules. This is the phase I am currently in. For GUI, I am looking through this guide as I type:

http://zetcode.com/tutorials/pyqt4/firstprograms/

Qt is a cross-platform GUI library, so I felt it would be a good first choice; however, users on Freenode (#Python) suggested trying various other GUI toolkits, as they “all suck a little bit”.

Will add more as I learn.

Advertisements

One of the primary purposes of this blog is tutorials and guides in readable formats free of condescension or esoteric terms, so here’s a guide on commands you probably know.

This does NOT replace a working knowledge of Linux built through reading or experience, but should prove helpful in filling in gaps.

1. Disk partitioning:

The majority of Linux installers use a shiny GUI installer now that does all this for you, but it’s still important to know how to work with partitions, especially if you plan to dual-boot.

partition tools:

cfdisk- (my personal favorite)

a semi-GUI partition tool that is fairly self explanatory- you may have to use mkswap and/or mkfs afterward

parted- (second most common)

a far less friendly partition tool released by GNU. Some more picky operating systems will reject fdisk/cfdisk partition tables in favor of this, so it’s worth getting to know.

mkpart: makes a partition from x to y

— Command: mkpart [part-type fs-type name] start end

print: displays the current partition table

quit: exits

There are many other useful tools, but I do not have room to go into them

more on GNU parted: https://www.gnu.org/software/parted/manual/parted.html

also, I suggest using a graphing calculator or a piece of paper to record and calculate partition size and position as you go

2: Connecting to internet (the hard way)

internet configuration tools: ifconfig, iwconfig, wicd, wifi-menu, network-manager,ip-link

*note: this portion of the guide will NOT work on FreeBSD, or some Linux distros

Most distros will have a GUI and a proprietary network manager for that GUI, but it’s nice to know how to do this manually. Also note these programs can be used a number of ways and I am merely writing about how I use them. Also note I am not an expert in these areas.

iwconfig: primarily focuses on the hardware side of connecting. Just the command itself will show all network interfaces/adapters and their status.

iwconfig <interface> essid “network name”: will connect to “network name” without password

type “man iwconfig” for more info

ifconfig: deals more with the software side of networking, the command alone will list network info, such as IP address, subnet mask, etc.

ifconfig can be used similarly to iwconfig to connect to a network.

type “man ifconfig” for more info

ip-link: Not too familiar with this, but I’ve used it to disable and enable the network

ip-link set <interface name> down: will disable the network interface

ip-link set <interface name> up: will enable the network interface

type “man ip-link” for more info

Wicd, Network-Manager, and wifi-menu are separate application that must be installed to your system, but are more efficient and friendly in dealing with networks. Wicd will run in the background and auto-connect to the network of your choice, Network-Manager is the background process that enabled you to use the network icon in the top right in Gnome, and wifi-menu is a minimal menu used for one-time connection to a network.

3. File permissions/management.

Unlike the above commands, the command line is still superior to GUI for file permission and ownership management, since running the x server as root is a security nightmare.

tools for file permissions and management: chmod, chown, ls, cp, mv, ln

chmod: used to change a file’s permissions and access. There are many formats in which permissions may be granted, but I personally find the number one the easiest. It is worth taking the time to memorize.

chmod 777 <file_name>: never do this

chmod 666 <file_name>: never do this

chmod 700: owner and root can do whatever they want with the file, no one else can

it’s split up into 3 numbers: chmod <owner><group><public/other> <file_name>

7 = read, write, and execute

6 = read and write

5 = read and execute

4 = read only

(you will almost never need 2 or 3)

1 = execute only

0 = no permissions

chmod +x <file_name>: make executable

(also, you can make a file inaccessible to root using a command called sunlink, but sunlink may be removed by root so the trick will not usually work)

chown: change file owner

chown <owner> <file>

chown -R <owner> <file>: recursive, changes subdirectory ownership as well

ls: list files in a given directory

ls -a: list all files, even hidden

ls -l: list files and permissions

cd: change directory

cd <path>

ln: used for symlinks

I am not experienced with symlinks (symbolic links), but the command should look like this:

ln -s <source directory> <directory>

cp: copy

cp <path to file 1> <path to file 2>

mv: move

mv <path to file 1> <path to destination>

4. Scripting

This is me being hypocritical, but knowing both Perl and Bash scripting is essential to the advanced Linux user. Documentation on both is available online, and I highly recommend the O’Reilly guide on Perl.

5. Software installation

Although different for each distro, I feel I should cover how installation works. Each distro will have two package managers, or one that functions for two purposes. One will fetch files from online, and get everything for you (yum, apt-get, zypper, pacman, slackpkg, etc.) and one that can install from local packages (rpm, apt, pacman, installpkg). Alternately, some distros use ports, which involves extracting a portsnap, then compiling source code from the ports directory (will allow you to customize more and check source code, but for larger programs will take a very long time)

6. IRC

This is one you don’t necessarily need, but I highly recommend knowing the basics of IRC as most distros have a Freenode channel for free live support.

I personally use xchat, but these commands should be similar if not the same for all IRC clients connected to Freenode-

/msg NickServ identify <password>: will log you in if you registered the nickname you use

/join #(name): will join a channel

typing ctrl+k will let you pick a color for just that line

(ctrl+k)4 hello this line is red: will print out line in red reading “hello this line is red”

7. Mounting

Mounting a filesystem means you create a directory you can then access as if part of your local filesystem.

1. (in terminal) go to /mnt

2. make a directory, can be named anything (mkdir foo)

3. mount the device (mount /dev/sr0 /mnt/foo)

4. go into the device (cd /mnt/foo)

Image

I am relatively new to Linux, but the above skills have gotten me through using just about every distro out there. Enjoy.