Linux tips --- required for getting started with Linux

Source: Internet
Author: User
Getting started -- Linux tips

Linux tips (1)

It may be inconvenient to use Linux at first, but it will become more and more convenient after some skills are mastered for a while. the following are some of my experiences and skills that have been accumulated since I used Linux. I believe this will help beginners.

1. Use the virtual console

After logging on to the system, press Alt + F2. Then you can see the "login:" prompt, which is the second virtual console. Generally, the newly installed Linux has four virtual consoles. You can use Alt + F1 ~ Alt + F4 to access the virtual console. The most useful time is that when a program fails to lock the input, you can switch to another virtual console to log in and kill the wrong process.

2. copy and paste

Character interface: whether slackware or RedHat is installed, a program named GPM is automatically run every time it is started. After the program runs, you can copy and paste it with the mouse. the specific method is to hold the left mouse button and drag it to make the place to be copied reversed. At this time, the area to be reversed has been copied, right-click the copied content and paste it at the cursor position.

X-window: The copy operation is the same as that on the Character interface. If the three-Key mouse is used, press and paste the key, press the left and right keys at the same time (select emulate 3 button in the mouse settings when xf86 is configured ).

3. quick access to some Directories

Type Cd ~ You can access the user's home directory.

Type CD-to enter the previous directory.

4. Use of the soft drive

For Linux ext2 file system, run the following command:

# Mount-T ext2/dev/fd0/mnt

For a floppy disk in DOS format, run the following command:

# Mount-T msdos/dev/fd0/mnt

Then you can access the content of the floppy disk in/mnt. Note that you need to unmount the file system on the floppy disk before removing the floppy disk. # umount/MNT; otherwise, information will be lost.

To create a file system on a floppy disk, run the following command:

# Mke2fs/dev/fd0 1440

5. display the color directory list under RedHat

Open/etc/bashrc and add the following line:

Alias ls = "ls -- color"

The color directory list will be displayed as shown in slackware when Bash is started next time. The color meanings are as follows:

Blue --> directory

Green --> Executable File

Red --> compressed file

Light blue --> link file

Gray --> other files

6. display file type

You can use the command file to know whether a file is an executable file in ELF format, a shell script file, or other formats, for example:

# File startx

7. command file path

When you type some commands such as find, shutdown, mount, and startx, do you want to know which directory these files are stored in? Use commands

Whereis can be implemented, as shown in figure

# Whereis startx

8. Search for files

The find command must add some parameters to check the file, for example:

# Find/usr-name xf86setup-print

Find the file xf86setup in/usr.

9. Delete useless core files

Sometimes a file named core is generated after the program runs. This file is usually large and useless. You can delete it to release space.

10. Unzip the .tar.gz File

To decompress the .tar.gz file, you must first decompress it with gunzip and then decompress it with tar. This can be done once in Linux, for example:

# Tar zxpvf sample.tar.gz

11. display the long file name in the Win95 Partition

If you find that the long file life In the Win95 partition cannot be displayed, you can mount it in vfat mode again. you can modify the/etc/fstab file for the Mount partition at startup and change the msdos text to vfat. if you cannot use vfat mount, recompile the core and add support for vfat.

12. Norton commander in Linux

After you type the command Mc at the prompt, you will see a very similar interface with Norton commander. In fact, the functions are very similar or even more powerful, for example, you can directly operate the files in the .tar.gz package (a bit like zipmagic ).

13. directly go to X after startup

Edit the/etc/inittab file and change ID: 3: initdefautl to ID: 4: initdefautl. however, there may be some problems with the search path. When you shut down, you must directly go to/sbin to execute shutdown.

14. Run the X program in the background

When you run an X program, do not forget to add an & sign next to it, such as # Netscape & otherwise, you will not be able to enter the command in that terminal window before launching the program to be executed.

15. Force exit x

Sometimes in X, the mouse and keyboard do not work due to program errors. In this case, don't worry, because in Linux, there is almost no vicious crash like IN Win95, you only need to press CTRL + ALT + backspace to return to the character interface.

Linux tips (2)

1. After Win9x is reinstalled, Lilo fails to start Linux.

You only need to start Linux with a floppy disk and run lilo once. For RedHat, run mkbootdisk to create a boot disk. For example:

Mkbootdisk -- devices/dev/fd0 2.0.34-1

2.0.34-1 is a directory under/lib/modules.

2. Change DOS/windows to the OS started by default.

RedHat uses Linux as the OS started by lilo by default, that is, boot: After the prompt is displayed, press enter to start Linux. If you want to change to DoS/Windows, modify the file/etc/Lilo. conf, put the DOS Startup part in front, and run lilo again. For example, you can extract Lilo. conf from:

Boot =/dev/hda

Map =/boot/Map

Install =/boot. B

Prompt

Timeout = 50

Image =/boot/vmlinuz-2.0.34-1

Label = Linux

Root =/dev/hdc5

Read-Only

Other =/dev/hda1

Label = DoS

Table =/dev/hda

Changed:

Boot =/dev/hda

Map =/boot/Map

Install =/boot. B

Prompt

Timeout = 50

Other =/dev/hda1

Label = DoS

Table =/dev/hda

Image =/boot/vmlinuz-2.0.34-1

Label = Linux

Root =/dev/hdc5

Read-Only

3. Remove the Lilo information in the pilot zone.

After lilo is installed, if the number or partition of the hard disk changes, the hard disk cannot be started. In this case, you only need to use a floppy disk to start dos and then run fdisk/MBR. (This method can also clear viruses in any boot Area)

4. Enable X to support the AGP video card

Download an ax 4.1, that is, acceleratedx 4.1, a commercial version of X server. In addition to the AGP video card, ax also supports multiple card numbers. In addition, you can also set the resolution, refresh rate, and other parameters with the setting program xsetup of ax. However, I don't know how it works with the AGP card, because I am still using S3 765, Which is outdated. :(

5. save man or info information as a text file

Take tcsh as an example: Man tcsh | col-B> tcsh.txt

Info tcsh-O tcsh.txt-S

6. Use the current path as the prompt

For Bash, add a line in. bashrc:

PS1 = "\ $ PWD \ $"

For tcsh, add a line in. tcshrc:

Set prompt = "%/>"

7. Compress executable files

In Linux, there is a command similar to pklite and lzexe in DOS-gzexe. In addition, the compression ratio can generally exceed 50%, which is useful when the space is tight. For example:

/Dosc/temp # ls-Al

Total 148

-Rwxr-XR-x 1 Root 149564 Dec 8 :33 gawk

/Dosc/temp # gzexe gawk

Gawk: 54.5%

/Dosc/temp # ls-Al

Total 216

-Rwxr-XR-x 1 Root 68710 Dec 8 15:36 gawk

-Rwxr-XR-x 1 Root 149564 Dec 8 :33 gawk ~

/Dosc/temp #

8. view the Linux Startup Information

When Linux is started, the information displayed on the screen is too late to be visible. If you are interested in the information, you can run the dmesg command to view it after it is started.

9. process files with special characters in the file name

If a file name is-file, if you want to delete it, typing Rm-file will display invalid option. Since the first character of the file name is-, Linux regards the file name as an option, you can add -- to solve this problem, such as RM ---file. If it is another special character, you can add a \ before the special character, or use double quotation marks to enclose the entire file name.

10. process a whole directory at a time

Many common Linux/Unix commands, such as RM and CP, have a parameter -----R, which indicates recursion, you can add the parameter-R to the command to operate the target directory and all its subdirectories, for example:

Rm-RF/test (F indicates force). This command completely deletes the sub-directory test in the root directory, which is similar to the deltree in DOS. Of course, be careful when using this command. Another example is:

CP-r/test/test1 is similar to xcopy/s in DOS.

11. Modify the logon screen

To local machine:

First modify the file/etc/issue to the desired content, and then modify the file/etc/rc. d/RC. local (RedHat) or/etc/rc. d/RC. S (slackware) comment out the following sentence:

# This will overwrite/etc/issue at every boot. So, make any changes you

# Want to make to/etc/issue here or you will lose them when you reboot.

Echo "">/etc/issue

Echo "Red Hat Linux $ R">/etc/issue

Echo "kernel $ (uname-R) on $ A $ (uname-m)">/etc/issue

CP-F/etc/issue/etc/issue.net

Echo>/etc/issue

Otherwise,/etc/issue will be changed every time it is restarted.

Remote machine for telnet:

First, rename the file/etc/usr/sbin/in. telnetd. For example, change it to in.telnetd.exe, compile a shell script named in. telnetd, and call in.telnetd.exe after displaying the required content. For example:

#! /Bin/sh

CAT/etc/login. BANNER # content to be displayed before the logon prompt

Echo-n ""

Exec/usr/sbin/in.telnetd.exe

12. Several useful aliases

Several aliases that can facilitate operations and reduce misoperations are recommended to put them in the startup file, such as/etc/bashrc.

Alias Rm = 'rm-I'

Alias CP = 'cp-I'

Alias mv = 'mv-I'

# The first three aliases are used to notify you to confirm before deleting or overwriting the file.

# If yes, it is strongly recommended that slackware users add it as well, because once a file is deleted in Linux/Unix

# Division can no longer be restored.

Alias L = 'LS-l'

Alias CD... = 'CD ..'

Alias Utar = 'tar xvfz' # parses the * .tar.gz File

Alias inforpm = 'rpm-QPI '# displays RPM package information

Alias scheduled PM = 'rpm-UHV '# Install the RPM package

Alias listrpm = 'rpm-qpl '# list files in the RPM package

Alias uistrpm = 'rpm-e' # reverse install the RPM package

13. Use commands to complete

Command-line completion means that when the entered characters are sufficient to determine the next unique file in the directory, you only need to press the tab key to automatically complete the remaining parts of the file name, for example, to unpackage the file gcc-2.8.1.tar.gz under directory/freesoft, when you type the file to tar xvfz/freesoft/g, if the file is the only file starting with G in the directory, you can press the tab key. The command is automatically completed as follows: tar xvfz/freesoft/gcc-2.8.1.tar.gz, very convenient.

14. last tip

If you have time, take a look at the FAQ files provided by the system, because most of the problems you encounter can be found in the answers.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.