|
L in u X ba sics for h acke rs g e t t I n g s t a r t e d w I t hBog'liq linuxbasicsforhackerscat hackingskills
Hacking is the most valuable skill set of the 21st century!
If you don’t use the redirect symbol, Linux will spit back the contents of
your file.
To add, or append, more content to a file, you can use the
cat
command
with a double redirect (
>>
), followed by whatever you want to add to the end
of the file. Here’s an example:
kali >
cat >> hackingskills
Everyone should learn hacking
Linux once again goes into interactive mode, waiting for content to
append to the file. When I enter
Everyone should learn hacking
and press
ctrl
-D, I am returned to the prompt. Now, when I display the contents of
that file with
cat
, I can see that the file has been appended with
Everyone
should learn hacking
, as shown here:
kali >
cat hackingskills
Hacking is the most valuable skill set of the 21st century! Everyone should
learn hacking
If I want to overwrite the file with new information, I can simply use the
cat
command with a single redirect again, as follows:
kali >
cat > hackingskills
Everyone in IT security without hacking skills is in the dark
kali >
cat hackingskills
Everyone in IT security without hacking skills is in the dark
As you can see here, Linux goes into interactive mode, and I enter the
new text and then exit back to the prompt. When I once again use
cat
to see
the content of the file, I see that my previous words have been over written
with the latest text.
File Creation with touch
The second command for file creation is
touch
. This command was origi-
nally developed so a user could simply touch a file to change some of its
details, such as the date it was created or modified. However, if the file
doesn’t already exist, this command creates that file by default.
Getting Started with the Basics
|
| |