Ox1
A few days ago to participate in the CCTF contest there is a Web problem is command execution, but the actual test is the file content to view the command and the way to bypass, here to sum up a wave bar.
0x2
1.more 2.cat 3.TAC Command, Flashback display 4.head command, which content can be displayed
5.tail command, you can specify which content is displayed 6.less is similar to more, but better than more is that it can "PG DN" "PG up" page.
0X3
More syntax, parameters and commands;
More [parameter options] [file]
The parameters are as follows:
+num starting from Num line;
-num defines the screen size for NUM lines;
+/pattern starts from the first two lines of the pattern;
-C clear the screen from the top and then display;
-D Prompt Press space to continue, ' Q ' to quit. (Pressing the NULL key to continue, press the Q key to exit), disable the ringing function;
-L ignores Ctrl+l (page break) characters;
-P pages are changed by clearing the window instead of scrolling. A bit similar to the-c parameter;
-S displays consecutive empty lines as one line;
-U Remove the underline from the contents of the file
The action command to exit more is Q
more parameter application examples;
# more-dc/etc/profile Note: Display the prompt and display from the top of the terminal or console;
# more +4/etc/profile Note: Starting from the 4th line of profile;
# more-4/etc/profile Note: Display 4 rows per screen;
# more +/mail/etc/profile Note: Start with the first two lines in the profile of a MAIL word;
More action instructions;
When we look at a larger file, we use more action instructions, such as ctrl+f (or SPACEBAR) is to display a screen down, Ctrl+b is to return to the previous screen, the ENTER key can scroll down to display n rows, to pass the default is 1 rows;
We only talk about a few commonly used, and try to know it by ourselves;
Enter down n rows, need to be defined, default to 1 rows;
CTRL+F scroll down one screen;
The null key scrolls down one screen;
Ctrl+b return to the previous screen;
= Output the line number of the current line;
: F output File name and line number of the current line;
V Call VI Editor;
! command to invoke the shell and execute the command;
Q Exit More
When we look at a file, want to call VI to edit it, do not forget the V-action command, which is more convenient;
Examples of other commands used in combination with piping and more;
For example, we list a directory of files, because the content is too much, we should learn to use more to page display. This has to do with plumbing | Together, for example:
# Ls-l/etc |more
2. Cat commands
How to use: Cat [-ABEENSTTUV] [--help] [--version] FileName
Description: Connect the file string to the basic output (screen or add > FileName to another file)
Parameters:
-N or--number the number of rows for all outputs starting from 1
-B or--number-nonblank and-n similar, except for blank lines not numbered
-S or--squeeze-blank when you encounter a blank line that has more than two consecutive lines, replace the blank line with one line
-V or--show-nonprinting
Example:
Cat-n textfile1 > Textfile2 Add the file contents of the Textfile1 and enter the Textfile2 file.
Cat-b textfile1 textfile2 >> textfile3 Append the contents of the Textfile1 and Textfile2 to the textfile3 after adding the line number (blank line not added) to the file.
Example:
Add a line number to the Textfile1 file and enter the Textfile2 file.
Cat-n textfile1 > Textfile2
Append the contents of the Textfile1 and Textfile2 files to the textfile3 after adding the line number (blank line not added).
Cat-b textfile1 textfile2 >> textfile3
Cat/dev/null >/etc/test.txt This is for emptying/etc/test.txt archive content
Cat can also be used to make image file. For example, to make a soft disc image file, put the floppy
cat/dev/fd0 > OUTFILE
3:TAC command, Reverse display
TAC: Starting from the last line, you can see that the TAC is the reverse display of cat!
4, Head command, you can specify the display of those content
Grammar:
[Root @test/root]# Head [-N number] [file name]
Parameter description:
-N: Show number line
Description
The head of the English meaning is "boss", then the use of this thing naturally is to show a file of the first few lines! That's right! That's it! If you do not add parameters to the default output of the first 10 lines of content, do not believe that the operation of their own, you can also customize the output of the number of lines to add "head-n numbers filename" Can!
For example, we show the first 10 lines of/etc/profile, it should be: # Head-n 10/etc/profile
5, Tali command, you can specify the display of those content
Tail is the number of lines after which the contents of a file are displayed;
The usage is relatively simple;
Tail-n the value file name of the row;
For example, we show the last 5 lines of/etc/profile, which should be:
# tail-n 5/etc/profile
6, less and more similar, but better than more is that he can [PG DN][PG up] page!
More, less
In fact, the two commands have a great similarity between the contents of the page display file, but there are differences, as follows:
1) More: pagination displayed as a percentage indicating how much content has been displayed to the user
Less: no percent hint
2) Less is more flexible and can be used to scroll through page down page and page up to see what has been shown, and more does not have
3) You can use/' character ' to enter the characters or strings to be searched for in the content shown in less and highlight the
- nl
Output line number when displaying file contents, similar function as cat-n, and full output
8.od
Reads the contents of the file in binary mode.
0x4
It is worth mentioning that this topic filters a lot, but VI does not filter, although the cat filter is empty, but can cacatt bypass, or use the TAC command flashback output.
Linux read File command bypasses posture