Linux command under which folder
$PATH
To an array assignment:
Char buff[100]
Cheat [1] = "ASD"
Memset(&buff,0,sizeof(buff))
Sprintf(buff,”%s”,a)
Modify the makefile time:
find ./* -exec touch {} +;
find . -type f -exec touch {} \;
touch *
Multi-folder:
find ./ -type f |xargs touch
#date -s 2019/01/01
Touch file
find Find files
find -iname [directory] filename: find the specified file in the specified directory (do not specify a directory to the current directory)
'-Name filename' direct to locate the file names
'-Type filetype' look through the file type, filetype contains f, b, c, d, l, s, etc.
'D' indicates that the file is a directory;
'-' indicates that the file is a normal file;
'L' indicates that the file is a link file (linux file),
'B' indicates that the file is a block device such as / dev / sda is such files.
'C' indicates that the file is a serial port device, such as a keyboard, a mouse.
'S' indicates that the file is between files socket (socket), for interprocess communication
Find [path] [parameter]
'-Atime + n / -n': access or execution time is greater than / less than n days file
'-Ctime + n / -n': write, change attributes inode (e.g. change the owner, permissions or link) time is greater than / less than n days file
'-Mtime + n / -n': write time is greater than / less than n days file
stat can be a time to file
Find files under linux:
which
whereis
locate
Pipe symbol:
ls / dev | more: everything that appears on one page
ls / dev> filenames.txt: recording with filenames.txt ls display all results
>: Create a new txt file, if the file already exists, it is overwritten
>>: Append new content in the file already exists
cat >> friends << "EOF"
> a
> b
> c
> EOF
Saves the contents of the next input file to friends inside, when the input EOF the end.
Output program results to the specified file
iperf3 -s >> /opt/result/udp.txt: appended to the file
iperf3 -s > /opt/result/udp.txt
iperf3 -s | tee -a /opt/result/udp.txt: appended to the file
iperf3 -s | tee /opt/result/udp.txt
ls lists files and directories
\ "Root"
-A: lists all files, including hidden files
".XXX" The file is a hidden file
-R: displays files in all subdirectories
--color: executable file with a green, white ordinary files, directories, blue
ls --color = never * .txt> report: the file does not display color, referred to the report in txt
ls -l: Display File Properties
first letter:
'D' indicates that the file is a directory;
'-' indicates that the file is a normal file;
'L' indicates that the file is a link file (linux file
'B' indicates that the file is a block device such as / dev / sda is such files.
'C' indicates that the file is a serial port device, such as a keyboard, a mouse.
'S' indicates that the file is a file socket (socket), for interprocess communication.
Second row: link node occupied
Third row: your main
The fourth column: the owning group
groupadd: Add a user group
chgrp: Change the file belongs to group
chgrp [Group] [File]
chgrp -R [Group] [file]: file in the directory includes sub
chown Change your master file
chown [ -R ] account name filename
chown [ -R & lt ] Account Name: group name file name
chmod change the user to perform read and write permissions to the file
the chmod [-R & lt] XYZ file name
The first column of ls -ld test
Using a digital to replace rwx, r 'equals 4,' w 'is equal to 2,' x 'is equal to 1,' - 'is equal to 0,' - rwxrwx- 'is represented by numeral' 770 ', in particular in such a way:' rwx '= 4 + 2 + 1 = 7;' rwx '= 4 + 2 + 1 = 7;' - - - '= 0 + 0 + 0 = 0
In linux system, a default directory permissions to 755, and the default permissions of a file 644
Special to modify the file attributes chattr
the chattr [+ - =] [ASaci [file or directory name]
'+ - =': respectively increase, decrease, setting
'A': after increasing the property, atime of a file or directory will not be modified;
'S': after increasing the attribute, the synchronization data will be written to disk;
'A': the increase in the property, can not be deleted is added, the user can not set the non-root attribute;
'C': This file is automatically compressed, decompressed automatically read;
'I': After the increase, so that the file can not be deleted, renamed, then set link, write, add data
lsattr read special permission
the lsattr [-ar] [file / directory name]
'-A': ls -a option similar to that list together, along with hidden files;
'-R': together with the data listed in subdirectories
cd into the directory
cd /: into the root directory
cd / usr: just returned to the parent directory
cd ..: back to the parent directory
cd ../: to the parent directory
cd ../ ..: to the secondary directory
cd / home / zhu: back to the specified directory
cd ~: into the user's personal directory, root i.e. the user / root, i.e. individual user / home / zhu
Now pwd directory
Print out the current directory
mkdir Create a new directory
mkdir -p / home / zhujipo / test: it creates multiple new directory
mkdir test
mkdir .test
rm delete the directory
rm tset -rf
rm -fr test
rmdir: delete empty directories
mv change file and directory names, or move files
mv tset new_test
mv .test test
mv -i test test_1: Security Options
cp copy files and directories
cp test new_test
cp test /home/test
cp -i test test_1: prompt to overwrite the contents of
cp source destination directory -R: Copy the contents of the original directory of all files and subdirectories
touch access or create
If the file exists, change the file access time
It does not exist, create
Ln establish a connection file
LN [-s] [source file] [destination file]: There -s is soft connection, without hard link is
Hard link: the establishment of icode (index points), the content of the linked file without any changes (not cross file system, you can not create a directory link)
Soft Link: When reading the linked file, the action will read the file forwarded to the destination file, so read the target file
cat show text
cat test
If the file is too long, cat will not Collate
cat - n test: line number added
cat - n test: showing everything, including special characters
tac: displays text content (backwards)
more text content
more test
Automatically suspended at the end of the page, such as the user continues to press the space bar and then display
less display content
May be on the turn and the next turn, Spacebar to flip. 'J' key to move downwardly (click moves down one line), by the 'k' key to move upward. When using more and less viewing a file, you can press the '/' key, and then enter a word carriage return, so you can look up the word up. If the word can press a plurality 'n' key to display the next. Alternatively, you can not press '/' but by '?' Behind with the same word to search for this word, the only difference is that '/' in the search down in the current line, and the '?' In the current line up search
Show file specific location
DETAILED file lines show head
head / opt / txt first ten lines
Pre head -n 100 100 / opt / txt
After the tail / opt / txt ten lines
After 100 lines tail -n 100 / opt / txt
tail -f test: 10-line display the dynamic document