Open windows explorer and go to the [discdrive]\I386 folder, browse for "Winnt.sif" file and drag it to notepad...
Linux, Cisco, Microsoft, Networking
!!! Break The Security | Learn How to Hack !!!
Saturday, 22 June 2013
Sunday, 16 June 2013
Vi Editor Command
Linux and Unix are managed through a series of text files. Linux
administrators do not normally use graphical editors to manage these
configuration files. Editors such as WordPerfect, starOffice, and yes,
even Microsoft Word normally save files in a binary format that Linux
can't read. Popular text editors for Linux configuration files include
emacs, pico, joe, and vi.
While emacs may be the most popular text editor in the world of Linux, every administrator needs at least a basic knowledge of vi. While emacs may be more popular and flexible, vi may help you save a broken system. If you ever have to restore a critical configuration file using an emergency boot floppy, vi is probably the only editor that you'll have available. You need to know how to restore your system from a rescue floppy, which does not have enough room to carry any editor other than vi.So should know how to use vi editor.
If this is a new file, you should see something similar to above.
The box at the top represents where your cursor is. The bottom line keeps you informed about what is going on with your editing (here you just opened a new file). In between, there are tildes (~) as filler because there is no text in the file yet. Now here's the intimidating part: There are no hints, menus, or icons to tell you what to do. On top of that, you can't just start typing. If you do, the computer is likely to beep at you. And some people complain that Linux isn't friendly.
The first things you need to know are the different operating modes: command and input. The vi editor always starts in command mode. Before you can add or change text in the file, you have to type a command (one or two letters and an optional number) to tell vi what you want to do. Case is important, so use uppercase and lowercase exactly as shown in the examples! To get into input mode, type an input command. To start out, type either of the following:
Arrow keys-Move the cursor up, down, left, or right in the file one character at a time. To move left and right you can also use Backspace and the space bar, respectively. If you prefer to keep your fingers on the keyboard, move the cursor with h (left), l (right), j (down), or k (up).
The file reverts to the most recently changed version. So, if you just did a :w, you are stuck with the changes up to that point. If you just want to undo a few bad edits, press u to back out of changes.
You have learned a few vi editing commands. I describe more commands in the following sections. First, however,
here are a few tips to smooth out your first trials with vi:
While emacs may be the most popular text editor in the world of Linux, every administrator needs at least a basic knowledge of vi. While emacs may be more popular and flexible, vi may help you save a broken system. If you ever have to restore a critical configuration file using an emergency boot floppy, vi is probably the only editor that you'll have available. You need to know how to restore your system from a rescue floppy, which does not have enough room to carry any editor other than vi.So should know how to use vi editor.
$ vi /tmp/test
~
~
~
~
~
“/tmp/test” [New File]
The box at the top represents where your cursor is. The bottom line keeps you informed about what is going on with your editing (here you just opened a new file). In between, there are tildes (~) as filler because there is no text in the file yet. Now here's the intimidating part: There are no hints, menus, or icons to tell you what to do. On top of that, you can't just start typing. If you do, the computer is likely to beep at you. And some people complain that Linux isn't friendly.
The first things you need to know are the different operating modes: command and input. The vi editor always starts in command mode. Before you can add or change text in the file, you have to type a command (one or two letters and an optional number) to tell vi what you want to do. Case is important, so use uppercase and lowercase exactly as shown in the examples! To get into input mode, type an input command. To start out, type either of the following:
- a-The add command. After it, you can input text that starts to the right of the cursor.
- i-The insert command. After it, you can input text that starts to the left of the cursor.
Arrow keys-Move the cursor up, down, left, or right in the file one character at a time. To move left and right you can also use Backspace and the space bar, respectively. If you prefer to keep your fingers on the keyboard, move the cursor with h (left), l (right), j (down), or k (up).
- w-Moves the cursor to the beginning of the next word.
- b-Moves the cursor to the beginning of the previous word.
- 0 (zero)-Moves the cursor to the beginning of the current line.
- $-Moves the cursor to the end of the current line.
- H-Moves the cursor to the upper-left corner of the screen (first line on the screen).
- M-Moves the cursor to the first character of the middle line on the screen.
- L-Moves the cursor to the lower-left corner of the screen (last line on the screen).
- x-Deletes the character under the cursor.
- X-Deletes the character directly before the cursor.
- dw-Deletes from the current character to the end of the current word.
- d$-Deletes from the current character to the end of the current line.
- d0-Deletes from the previous character to the beginning of the current line.
- ZZ-Save the current changes to the file and exit from vi.
- :w-Save the current file but continue editing.
- :wq-Same as ZZ.
- :q-Quit the current file. This works only if you don't have any unsaved changes.
- :q!-Quit the current file and don't save the changes you just made to the file.
The file reverts to the most recently changed version. So, if you just did a :w, you are stuck with the changes up to that point. If you just want to undo a few bad edits, press u to back out of changes.
You have learned a few vi editing commands. I describe more commands in the following sections. First, however,
here are a few tips to smooth out your first trials with vi:
- Esc-Remember that Esc gets you back to command mode. (I've watched people press every key on the keyboard trying to get out of a file.) Esc followed by ZZ gets you out of command mode, saves the file, and exits.
- u-Press u to undo the previous change you made. Continue to press u to undo the change before that, and the one before that.
- Ctrl+R-If you decide you didn't want to undo the previous command, use Ctrl+R for Redo. Essentially, this command undoes your undo.
- Caps Lock-Beware of hitting Caps Lock by mistake. Everything you type in vi has a different meaning when the letters are capitalized. You don't get a warning that you are typing capitals-things just start acting weird.
- :! command-You can run a command while you are in vi using :! followed by a command name. For example,
- type :!date to see the current date and time,
- type :!pwd to see what your current directory is,
- type :!jobs to see if you have any jobs running in the background.
- INSERT-When you are in insert mode, the word INSERT appears at the bottom of the screen.
- Ctrl+G-If you forget what you are editing, pressing these keys displays the name of the file that you are editing and the current line that you are on at the bottom of the screen. It also displays the total number of lines in the file, the percentage of how far you are through the file, and the column number the cursor is on.
Moving Around the File
Besides the few movement commands described earlier, there are other ways of moving around a vi file. To try these out, open a large file that you can't do much damage to. (Try copying /var/log/ messages to /tmp and opening it in vi.) Here are some movement commands you can use:- Ctrl+F-Page ahead, one page at a time.
- Ctrl+B-Page back, one page at a time.
- Ctrl+D-Page ahead one-half page at a time.
- Ctrl+U-Page back one-half page at a time.
- G-Goto the last line of the file.
- 1G-Go to the first line of the file. (Use any number to go to that line in the file.)
Searching for Text
To search for the next occurrence of text in the file, use either the slash (/) or the question mark (?) character. Follow the slash or question mark with a pattern (string of text) to search forward or backward, respectively, for that pattern. Within the search, you can also use metacharacters. Here are some examples:- /hello-Searches forward for the word hello.
- ?goodbye-Searches backward for the word goodbye.
- /The.*foot-Searches forward for a line that has the word The in it and also, after that at some point, the word foot.
- ?[pP]rint-Searches backward for either print or Print. Remember that case matters in Linux, so make use of brackets to search for words that could have different capitalization.
- :g/Local-Searches for the word Local and prints every occurrence of that line from the file. (If there is more than a screenful, the output is piped to the more command.)
- :s/Local/Remote-Substitutes Remote for the word Local on the current line.
- :g/Local/s//Remote-Substitutes the first occurrence of the word Local on every line of the file with the word Remote.
- :g/Local/s//Remote/g-Substitutes every occurrence of the word Local with the word Remote in the entire file.
- :g/Local/s//Remote/gp-Substitutes every occurrence of the word Local with the word Remote in the entire file, and then prints each line so that you can see the changes (piping it through more if output fills more than one page).
Using Numbers with Commands
You can precede most vi commands with numbers to have the command repeated that number of times. This is a handy way to deal with several lines, words, or characters at a time. Here are some examples:- 3dw-Deletes the next three words.
- 5cl-Changes the next five letters (that is, removes the letters and enters input mode).
- 12j-Moves down 12 lines.
Linux system administration commands
halt
This command shuts down the operating system, but can only be run by the root user.#halt
reboot
This command shuts down and restarts the operating system. It also can only be run by root.#reboot [will perform simple reboot]
#reboot -f [will perform fast reboot ]
init 0
This command also shuts down the operating system, and can only be run by root.#init 0
init 6
This command restart the operating system. It also can only be run by root.#init 6
man
This command opens the manual page for the command or utility specified. The man utility is a very useful tool. If you are unsure how to use any command, use man to access its manual page. For example, you could enter man ls at the shell prompt to learn how to use the ls utility.#man ls
info
The info utility also displays a help page for the indicated command or utility. The information displayed with info command will be in-depth than that displayed in the man page for the same command.info ls
su
This command switches the current user to a new user account. For example, if you’re logged in as student and need to change to user account to student2, you can enter su student2 at the shell prompt. This command is most frequently used to switch to the superuser root account.In fact, if you don’t supply a username, this utility assumes that you want to change to the root account. If you enter su -, then you will switch to the root user account and have all of root’s environment variables applied.
This command require password of the user you want switch.
Looking for Files
There are two basic commands used for file searches: find and locate
find
The find command searches through directories and subdirectories for a desired file. For example, if you wanted to find the directory with the grub.conf linux boot loader file, you could use the following command, which would start the search in the top-level root (/) directory:# find / -name grub.conf
# find /etc -name grub.conf
locate
If this is all too time-consuming, RHEL 5 includes a default database of all files and directories. Searches with the locate command are almost instantaneous. And locate searches don't require the full file name. The drawback is that the locate command database is normally updated only once each day, as documented in the /etc/cron.daily/mlocate.cron script.Getting into the Files
Now that you see how to find and get around different files, it's time to start reading, copying, and moving the files around. Most Linux configuration files are text files. Linux editors are text editors. Linux commands are designed to read text files. If in doubt, you can check the file types in the current directory with thefile * command.
cat
The most basic command for reading files is cat. The cat filename command scrolls the text within the filename file. It also works with multiple file names; it concatenates the file names that you might list as one continuous output to your screen. You can redirect the output to the file name of your choice.more and less
Larger files demand a command that can help you scroll through the file text at your leisure. Linux has two of these commands:more and less.
With the more filename command, you can scroll through the text of a file, from start to finish, one screen at a time. With the less filename command, you can scroll in both directions through the same text with the PAGE UP and PAGE DOWN keys. Both commands support vi-style searches.
head and tail
The head and tail commands are separate commands that work in essentially the same way. By default, the head filename command looks at the first 10 lines of a file; the tail filename command looks at the last 10 lines of a file. You can specify the number of lines shown with the -nx switch. Just remember to avoid the space when specifying the number of lines; for example, the# tail -n15 /etc/passwd
cp
The cp (copy) command allows you to take the contents of one file and place a copy with the same or different name in the directory of your choice. For example, the cp file1 file2 command takes the contents of file1 and saves the contents in file2. One of the dangers of cp is that it can easily overwrite files in different directories, without prompting you to make sure that's what you really wanted to do.mv
While you can't rename a file in Linux, you can move it. The mv command essentially puts a different label on a file. For example, the mv file1 file2 command changes the name of file1 to file2. Unless you're moving the file to a different partition, everything about the file, including the inode number, remains the same.ln
You can create a linked file.linked files are common with device files such as /dev/dvdwriter and /dev/par0. They're also useful for making sure that multiple users have a copy of the same file in their directories. Hard links include a copy of the file. As long as the hard link is made within the same partition, the inode numbers are identical. You could delete a hard-linked file in one directory, and it would still exist in the other directory. For example, the following command creates a hard link from the actual Samba configuration file to smb.conf in the local directory:
# ln smb.conf /etc/samba/smb.conf
# ln -s smb.conf /etc/samba/smb.conf
sort
You can sort the contents of a file in a number of ways. By default, the sort command sorts the contents in alphabetical order depending on the first letter in each line. For example, the sort /etc/passwd command would sort all users (including those associated with specific services and such) by username.grep and egrep
The grep command uses a search term to look through a file. It returns the full line that contains the search term. For example, grep 'root' /etc/passwd looks for my name in the /etc/passwd file.The egrep command is more forgiving; it allows you to use some unusual characters in your search, including +, ?, |, (, and). While it's possible to set up grep to search for these characters with the help of the backslash, the command can be awkward to use.
wc
The wc command, short for word count, can return the number of lines, words, and characters in a file. The wc options are straightforward: for example, wc -w filename returns the number of words in that file.sed
The sed command, short for stream editor, allows you to search for and change specified words or even text streams in a file. For example, the following command changes the first instance of the word Windows to the word Linux in each line of the file data, and writes the result to the file newdata:# sed 's/Windows/Linux/' data > newdata
# sed 's/Windows/Linux/g' data > newdata
awk
The awk command, named for its developers (Aho, Weinberger, and Kernighan), is more of a database manipulation utility. It can identify lines with a keyword and read out the text from a specified column in that line. Again, using the /etc/passwd file, for example, the following command will read out the username of every user with a root in the comment column:# awk '/root/ {print $1}' /etc/passwd
ps
It's important to know what's running on your Linux computer. The ps command has a number of critical switches. When trying to diagnose a problem, it's common to get the fullest possible list of running processes, and then look for a specific program. For example, if the Firefox Web browser were to suddenly crash, you'd want to kill any associated processes. The ps aux | grep firefox command could then help you identify the process(es) that you need to kill.who and w
If you want to know what users are currently logged into your system, use the who command or the w command. This can help you identify the usernames of those who are logged in, their terminal connections, their times of login, and the processes that they are running.Wildcards
Sometimes you may not know the exact name of the file or the exact search term. This is when a wildcard is handy. The basic wildcards are shown
Wildcard
|
Description
|
*
|
Any number of
alphanumeric characters (or no characters at all). For example, the ls ab*
command would return the following file names, assuming they exist in the
current directory: ab, abc, abcd.
|
?
|
One single
alphanumeric character. For example, the ls ab? command would return the
following file names, assuming they exist in the current directory: abc, abd,
abe
|
[ ]
|
A range of
options. For example, the ls ab[123] command would return the following file
names, assuming they exist in the current directory: ab1, ab2, ab3.
Alternatively, the ls ab[X-Z] command would return the following file names,
assuming they exist in the current directory: abX, abY, abZ.
|
env
This command displays the environment variables for the currently logged-in user.echo
This command is used to echo a line of text on the screen. It’s frequently used to display environment variables. For example, if you wanted to see the current value of the PATH variable, you could enterecho $PATH
top
This command is a very useful command that displays a list of all applications and processes currently running on the system. You can sort them by CPU usage, memory usage, process ID number, and which user owns themwhich
This command is used to display the full path to a shell command or utility. For example, if you wanted to know the full path to the ls command, you would enter which lswhoami
This command displays the username of the currently logged-in user.netstat
This command displays the status of the network, including current connections, routing tables, etcroute
This command is used to view or manipulate the system’s routing table.ifconfig
This command is used to manage network boards installed in the system. It can be used to display or modify your network board configuration parameters. This command can only be run by the root user.Do practice and practice until you feel comfortable with these commands.
Basic Linux commands
Basic Linux commands
$ mkdir [ directory name ]
mkdir command is used to create new directory. Let’s create a example directory.
$mkdir example
we can also use this command to make more then 1 directory at same time,
$mkdir -p a b c d e f g h i j k l
This command will create many directory at same time.
$mkdir -p a/b/c/d/e/f/g/h/i/j/k
This will create directory inside each other.
$mkdir -p a/{b,c,d,e,f,g,h,i,j,k}
$mkdir -p a/computer{b,c,d,e,f,g,h}networking
this command will create directory like this
[root@localhost c]# mkdir -p a/computer{b,c,d,e,f,g,h}networking
[root@localhost c]# tree
.
`-- a
|-- computerbnetworking
|-- computercnetworking
|-- computerdnetworking
|-- computerenetworking
|-- computerfnetworking
|-- computergnetworking
`-- computerhnetworking
8 directories, 0 files
[root@localhost c]#
$ cat [ file name ]
now create a file. Syntax for creating file is
$cat > [file name]
This command can be used in three way
To create a new file
To append the contents of file.
$cat [file name] ------------------------ To see the contents of file
$cat > [file name]---------------------- To create a file
$cat >> [file name ]-------------------- To append the contents of file
$ cd [ destination directory path]
It is easy to change directories in Linux. Just use cd and name the absolute path of the desired directory. If you use the relative path, just remember that your final destination depends on the present working directory.[root@localhost c]# cd /
pwd
In many configurations, you may not know where you are relative to the root (/) directory. The pwd command, which is short for print working directory, can tell you, relative to root (/). Once you know where you are, you can determine whether you need to move to a different directory.cp
The cp (copy) command allows you to take the contents of one file and place a copy with the same or different name in the directory of your choice. For example, the cp file1 file2 command takes the contents of file1 and saves the contents in file2. One of the dangers of cp is that it can easily overwrite files in different directories, without prompting you to make sure that's what you really wanted to do.mv
You can rename a file in Linux, you can move it. The mv command essentially puts a different label on a file. For example, the mv file1 file2 command changes the name of file1 to file2. Unless you're moving the file to a different partition, everything about the file, including the inode number, remains the same.rm
rm command is used to remove the regular files. It will ask before removing files.rmdir
it will remove the empty directory. If directory is full then use rm –rf [directory name]Linux file system and directory structure
Everything in Linux can be reduced to a file. Partitions are associated
with files such as /dev/hda1. Hardware components are associated with
files such as /dev/modem. Detected devices are documented as files in
the /proc directory. The Filesystem Hierarchy Standard (FHS) is the
official way to organize files in Unix and Linux directories.
Have you wondered why certain programs are located under /bin, or /sbin, or /usr/bin, or /usr/sbin?
For example, less command is located under /usr/bin directory. Why not /bin, or /sbin, or /usr/sbin? What is the different between all these directories?
In this article, let us review the Linux filesystem structures and understand the meaning of individual high-level directories.
Linux file system and directory structure
Several major directories are associated with all modern Unix/Linux operating systems. These directories organize user files, drivers, kernels, logs, programs, utilities, and more into different categories. The standardization of the FHS makes it easier for users of other Unix-based operating systems to understand the basics of Linux. Every FHS starts with the root directory, also known by its label, the single forward slash (/). All of the other directories shown in Table are subdirectories of the root directory. Unless they are mounted separately, you can also find their files on the same partition as the root directory.
/
|
The root
directory, the top-level directory in the FHS. All other directories are
subdirectories of root, which is always mounted on some partition. All
directories that are not mounted on a separate partition are included in the
root directory?s partition.
|
/bin
|
Essential
command line utilities. Should not be mounted separately; otherwise, it could
be difficult to get to these utilities when using a rescue disk.
|
/boot
|
Includes
Linux startup files, including the Linux kernel. Can be small; 16MB is
usually adequate for a typical modular kernel. If you use multiple kernels,
such as for testing a kernel upgrade, increase the size of this partition
accordingly.
|
/etc
|
Most basic
configuration files.
|
/dev
|
Hardware and
software device drivers for everything from floppy drives to terminals. Do
not mount this directory on a separate partition.
|
/home
|
Home
directories for almost every user.
|
/lib
|
Program
libraries for the kernel and various command line utilities. Do not mount
this directory on a separate partition.
|
/mnt
|
The mount
point for removable media, including floppy drives, CD-ROMs, and Zip disks.
|
/opt
|
Applications
such as WordPerfect or StarOffice.
|
/proc
|
Currently
running kernel-related processes, including device assignments such as IRQ
ports, I/O addresses, and DMA channels.
|
/root
|
The home
directory of the root user.
|
/sbin
|
System
administration commands. Don't mount this directory separately.
|
/tmp
|
Temporary
files. By default, Red Hat Linux deletes all files in this directory
periodically.
|
/usr
|
Small
programs accessible to all users. Includes many system administration
commands and utilities.
|
/var
|
Variable
data, including log files and printer spools.
|
Have you wondered why certain programs are located under /bin, or /sbin, or /usr/bin, or /usr/sbin?
For example, less command is located under /usr/bin directory. Why not /bin, or /sbin, or /usr/sbin? What is the different between all these directories?
In this article, let us review the Linux filesystem structures and understand the meaning of individual high-level directories.
1. / – Root
- Every single file and directory starts from the root directory.
- Only root user has write privilege under this directory.
- Please note that /root is root user’s home directory, which is not same as /.
2. /bin – User Binaries
- Contains binary executables.
- Common linux commands you need to use in single-user modes are located under this directory.
- Commands used by all the users of the system are located here.
- For example: ps, ls, ping, grep, cp.
3. /sbin – System Binaries
- Just like /bin, /sbin also contains binary executables.
- But, the linux commands located under this directory are used typically by system aministrator, for system maintenance purpose.
- For example: iptables, reboot, fdisk, ifconfig, swapon
4. /etc – Configuration Files
- Contains configuration files required by all programs.
- This also contains startup and shutdown shell scripts used to start/stop individual programs.
- For example: /etc/resolv.conf, /etc/logrotate.conf
5. /dev – Device Files
- Contains device files.
- These include terminal devices, usb, or any device attached to the system.
- For example: /dev/tty1, /dev/usbmon0
6. /proc – Process Information
- Contains information about system process.
- This is a pseudo filesystem contains information about running process. For example: /proc/{pid} directory contains information about the process with that particular pid.
- This is a virtual filesystem with text information about system resources. For example: /proc/uptime
7. /var – Variable Files
- var stands for variable files.
- Content of the files that are expected to grow can be found under this directory.
- This includes — system log files (/var/log); packages and database files (/var/lib); emails (/var/mail); print queues (/var/spool); lock files (/var/lock); temp files needed across reboots (/var/tmp);
8. /tmp – Temporary Files
- Directory that contains temporary files created by system and users.
- Files under this directory are deleted when system is rebooted.
9. /usr – User Programs
- Contains binaries, libraries, documentation, and source-code for second level programs.
- /usr/bin contains binary files for user programs. If you can’t find a user binary under /bin, look under /usr/bin. For example: at, awk, cc, less, scp
- /usr/sbin contains binary files for system administrators. If you can’t find a system binary under /sbin, look under /usr/sbin. For example: atd, cron, sshd, useradd, userdel
- /usr/lib contains libraries for /usr/bin and /usr/sbin
- /usr/local contains users programs that you install from source. For example, when you install apache from source, it goes under /usr/local/apache2
10. /home – Home Directories
- Home directories for all users to store their personal files.
- For example: /home/john, /home/nikita
11. /boot – Boot Loader Files
- Contains boot loader related files.
- Kernel initrd, vmlinux, grub files are located under /boot
- For example: initrd.img-2.6.32-24-generic, vmlinuz-2.6.32-24-generic
12. /lib – System Libraries
- Contains library files that supports the binaries located under /bin and /sbin
- Library filenames are either ld* or lib*.so.*
- For example: ld-2.11.1.so, libncurses.so.5.7
13. /opt – Optional add-on Applications
- opt stands for optional.
- Contains add-on applications from individual vendors.
- add-on applications should be installed under either /opt/ or /opt/ sub-directory.
14. /mnt – Mount Directory
- Temporary mount directory where sysadmins can mount filesystems.
15. /media – Removable Media Devices
- Temporary mount directory for removable devices.
- For examples, /media/cdrom for CD-ROM; /media/floppy for floppy drives; /media/cdrecorder for CD writer
16. /srv – Service Data
- srv stands for service.
- Contains server specific services related data.
- For example, /srv/cvs contains CVS related data.
Subscribe to:
Posts (Atom)