It's just a summary of some common commands, and the rest will be done later on in the Kali to gain insight into
pwd This command prints out the current directory
CD entry to a directory
./ refers to the current directory
.. / refers to the top-level directory of the current directory.
mkdir Create a directory-p it works by recursively creating directories, even if the parent directory does not exist. Another situation is that if you want to create a directory exists, will prompt an error, and then you add-p parameter, you will not error.
rmdir Delete directory-P removes the parent directory together. When there are directories in a directory, the prompt is not empty and cannot be deleted.
RM Deletes the directory or file. -F Force Delete-I prompt whether really delete-R delete directory, or error. Commonly used RM-RF XXX.
echo $PATH view environment variables. Add environment variables by path= "$PATH":/xxxx, or use absolute paths directly.
ls View a directory or file-a list of all files, including hidden files (beginning with.)-l lists file attribute information (size, date, permissions)-D lists the directory itself.
Catalog color is blue, executable is green, blue light shortcut
CP copy CP [options] [source file] [destination file]-D soft connect equals shortcut. -r copy directory. -I prompts whether to overwrite,-u only takes effect if the target file is present, if the original file is newer than the target file, it does not do any action.
MV Movement. -i,-u can be used to rename the MV old New
Cat View File contents-N Display line number-a displays all characters, including special characters TAC reverse print file to screen
echo "Sdsfs" >test.txt Write file >> write file (newline)
More is also used to view the contents of a file. When the file content is too much, a screen can not be taken up, and you use cat must not look at the previous content, then use more to solve the problem. When you finish reading a screen, press SPACEBAR to continue looking at the next screen. But after reading all the content, you will exit. If you want to quit early, just press the Q key.
Less is the same as more, but better than the more good can be turned upside down. The SPACEBAR can also be paged, while pressing the "J" key can be moved downward (click to move down one line) and press "K" key to move up. When you use more and less to view a file, you can click the "/" key and then enter a word carriage return so that you can find the word. If you have more than one word, you can press the "N" key to display the next. Alternatively, you can press "/" instead of "?" In the same word as word, the only difference is that "/" is searched down the current line, and "?" is to search up the current line.
The first 10 lines of the file are displayed directly after the head with the filename. If the Add –n option displays the first n rows of the file.
tail and head, followed directly with the file name, displays the last ten lines of files. If the plus-n option displays the last n rows of the file.
Linux file Properties :
D indicates that the file is a directory;-represented as a normal file; L is represented as a connection file (soft link)
Rwx the first three, the middle three belongs to the group, the last three bits are not the group permissions.
The 2nd column, which represents the node (inode) occupied by the connection, is usually related to how many directories are in the directory, and the link is described in more detail in a later section.
The 3rd column, which represents the owner of the file.
The 4th column, which represents the group to which the file belongs.
The 5th column, which represents the size of the file.
Columns 6th, 7th, and 8th are listed as the date the file was created or the most recent modification date, respectively, for the month date and time.
9th column, file name. If you have one in front of you. Indicates that the file is a hidden file.
To change permissions for a file:
Change the owning group Chgrp
Syntax: CHGRP [group name] [file name]
Change the owner of the file Chown
Syntax: Chown [-r] Account name file name
Chown [-r] Account name: Group name File name
Here, the-r option is used only for the directory, which is cascading changes that change not only the current directory, but the directory or file in the directory.
chmod Syntax: chmod [-r] XYZ file name (xyz here, representing a number)
The-r option functions as Chown, cascading changes.
On a Linux system, the default permission for a directory is 755, and the default permission for a file is 644.
You can also pass chmod u=rwx,og=rx test or chmod u-x test. User,group,others,all.
User/user Group changes
Added a group groupadd [-G GID] groupname normal user/group GID starting from 500 or 1000
Delete Group Groupdel groupname
Add User Useradd XXX
Change Password passwd username
change user login to login as username
Switch root identity with test account Su-
View login user name echo $LOGNAME
The which is used to find the absolute path to the executable file. which can only be used to find executable files under paths that appear in the PATH environment variable.
find [path] [parameter] (find will slowly become proficient in later use)
-atime +n: Access or execute files that are longer than n days
-ctime +n: Writing, changing Incode properties (such as changing owner permissions or connecting) files that are longer than n days
-mtime +n: Files with write times greater than n days
The file's Access Time,atime is changed when the file is read or executed. The Modified time,mtime of a file is changed when the file is written with changes to the contents of the file. The file's Create Time,ctime is changed as the content of the Inode changes when writing to a file, changing owner, permission, or link settings. As a result, changing the contents of a file changes mtime and CTime, but the CTime of the file may change when the mtime has not changed, for example, by changing the permissions of the file, but the contents of the file do not change. How to get a file of Atime mtime and CTime?
The ls-l command can be used to list atime, CTime, and mtime of files.
LS-LC filename Lists the CTime of the file
Ls-lu filename Lists the atime of the file
ls-l filename Lists the mtime of the file
Atime does not necessarily have to be modified after accessing the file, because: when using the Ext3 file system, the Atime information is not updated if the Noatime parameter is used on Mount. And this is added Noatime canceled, does not represent the real situation. Anyway, these three time stamp are placed in the inode. If the mtime, atime modify the inode will be changed, since the inode changed, then the CTime will be changed.
-name filename directly finds the file name of the file, this is the most used.
Linux Learning Note 1