Article Title: Tips for collecting and sorting Linux (1 ). Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
1. Set resolution in text mode
Add vga = xxx to grub startup parameters
value mode video ram
769 640 x 480 x 8 bit (1M)
785 640 x 480 x 16 bit (1M)
786 640 x 480 x 24 bit (1M)
771 800 x 600 x 8 bit (1M)
788 800 x 600 x 16 bit (1M)
789 800 x 600 x 24 bit (2M)
773 1024 x 768 x 8 bit (1M)
791 1024 x 768 x 16 bit (2M)
792 1024 x 768 x 24 bit (4M)
775 1280 x 1024 x 8 bit (2M)
794 1280 x 1024 x 16 bit (4M)
795 1280 x 1024 x 24 bit (8M
796 1600 x 1200 x 8 bit (2M)
798 1600 x 1200 x 16 bit (4M)
799 1600 x 1200 x 24 bit (4M)
2. Change the desktop resolution to 1024x768 (sometimes invalid, I don't know why)
Modify the/etc/X11/xorg. conf file. Separate the file before modification, just in case.
Comment out the line for setting the line frequency (required)
# HorizSync 31.5-37.9
In the Subsection "Dispaley" of Section "Screen", change the Modes line
Modes "1024x768"
3. Start Multiple X desktops
Alias
Alias X1 = 'startx --: 1-bpp 32-quiet &'
Alias X2 = 'startx --: 2-bpp 32-quiet &'
Or directly use the command
Startx --: 1-bpp 32-quiet &
Startx --: 2-bpp 32-quiet &
Then you can use CTRL + ALT + F8, CTRL + ALT + F9 to switch, and press CTRL + ALT + F12 accordingly.
The simplest method
Startx --: 1
4. Adjust the display
Xvidtune
5. Add the row number to the file output
Nl/etc/passwd
Nl/etc/passwd-s '.'
In vi
: %! Nl
6. case-sensitive Conversion
cat filename | tr "[a-z]" "[A-Z]"
7. count the number of rows in the file
Wc-l filename # line
Wc-c filename # char
Wc-w filename # word
8. Retrieve the root account password
Enter the single-user mode. for grub users, add single after a line of the kernel after the startup parameter,
Then you can change your password in single-user mode without using the password.
9. Set the grub Password
As described above, grub can easily access the machine as long as it can access the machine without a password.
Generate md5 code
Enter the command
Grub-md5-crypt
Then input the password you want to set, the grub-md5-crypt will generate a string xxxxxxxx.
Add to your grub configuration file/boot/grub. conf (some may be used in/boot/grub/menu. lst)
Add the following line of title
Password -- md5 xxxxxxxx
10. Use commands to pop up the optical drive
Eject # pop-up
Eject-t # Bounce
Very interesting
11. Reverse the File Content
Tac/etc/passwd
In vi
%! Tac in vi
12. Several Methods for outputting the first n rows of the file
Head-5 filename
Awk 'nr = 1, NR = 5 {print $0} 'filename
Sed-n '1, 5' filename
This method can work with other lines in the output file.
Sed-n'5, $ P' filename
13. Change grub background
The grub background uses the xpm file in the image format. Therefore, you need to convert your image to the xpm format and use gimp.
In X Window, enter
Gimp filename
Change the image color to 14
Right click on image-> mode-> indexed-> color number 14
Save it as an xpm file/yourpath/yourimage. xpm
You can also use commands
Convert yourimage.jpg-colors 14-geometry 640x480! Yourimage. xpm
Modify grub
Add
Splashimage (hd0, 0)/yourpath/yourimage. xpm
Some may be
Splashimage = (hd0, 0)/yourpath/yourimae. xpm
Partition (hdx,y}, depending on your specific situation. You can also compress the image into .gz format.
14. ssh skills
(1) remote command execution Without login
Format:
Ssh hostname command
For example:
Ssh hostname ls/usr/share/doc
(2) remote file copy scp, pscp for windows
Scp localfile username @ hostname:/newfilename
15. Use NFS QuickStart in Linux
Modify/etc/exports. If you do not consider security issues, add
/Master (rw) trusty (rw, no_root_squash)
Run again
Service nfs restart
Then you can mount it on the remote host.
Mount hostname: // media
16. ftp Automatic Login download shell script
SRC_FTP_SERVER = hostname
SRC_FTP_USER = anonymous
SRC_FTP_PASSWD = user@xxx.com
SRC_FTP_DIR =/diskimages/
Echo "open $ SRC_FTP_SERVER
User $ SRC_FTP_USER $ SRC_FTP_PASSWD
LCD $ {TMP_DIR}
Cd $ SRC_FTP_DIR
Binary
Get $ SRC_FTP_DIR/filename "| ftp-n 1>/dev/null 2> & 1
17. send an email under the command
Cat "mail content" | mail yourname@domain.com-s "mail title"
Cat/dir/file_conent | mail yourname@domain.com-s "mail title"
With accessories, mutt
Cat "mail content" | mutt yourname@domain.com-s "mail title"-a attach_file
Cat/dir/file_conent | mutt yourname@domain.com-s "mail title"-a attach_file
Some directories or files are removed when 18.tar is packaged.
Cd/
Tar cvf usr.tar usr -- exclude usr/share -- exclude/usr/bin/unzip
Do not add/root characters when adding a queue directory
19. Display date before/AFTER xx days
Date-d "now" # Same as date
Date-d "today" # Same as date
Date-d "45 days ago" #45 days ago
Date-d "45 days" #45 days later
20. Use the *. rarfile in Linux
Install the rar package (you will know it after google)
Compression
Rar a usr_0000.rar usr/share
Unlock
Rar x usr_0000.rar/root
21. Use command screenshot
Import-window root hello.jpg
22. convert non-interactive text to html
Vim-c ": TOhtml"-c ": wq %"-c ": q" filename
23. Others
Monitor file changes
Tail-f/var/log/messages
HTML-related commands in the command line
Wget www.xxxx.com/filename.tar.gz # download an object
Lynx www.163.com # view Webpage Through command line
Htmlview www.163.com # view the webpage through command line