Skip to content

Instantly share code, notes, and snippets.

@Gavriel770U
Last active August 11, 2024 08:16
Show Gist options
  • Save Gavriel770U/b0906ada292b7e991470b65231ea59c6 to your computer and use it in GitHub Desktop.
Save Gavriel770U/b0906ada292b7e991470b65231ea59c6 to your computer and use it in GitHub Desktop.
Linux Terminal Creating New File
#!/bin/bash
touch way1.txt
echo "This is the second way!" > way2.txt
> way3.txt
printf "This is the fourth way!\n" > way4.txt
>> way5.txt
# The sixth way is made if way 5 is too much like way 3,
# But you have to insert some data and then press CTRL+C to write to the file and save it.
cat > way6.txt
cp /dev/null way7.txt
dd if=/dev/zero of=way8.txt bs=1 count=0
truncate -s 0 way9.txt
@Gavriel770U
Copy link
Author

@Microsh1t Linux :D

@Microsh1t
Copy link

Hi

@Gavriel770U
Copy link
Author

Hello

@win3zz
Copy link

win3zz commented Aug 10, 2024

user@hostname:~$ cp /dev/null filename

@Gavriel770U
Copy link
Author

user@hostname:~$ cp /dev/null filename

cool i will add it, thanks :D

@win3zz
Copy link

win3zz commented Aug 11, 2024

Additional:

user@hostname:~$ dd if=/dev/zero of=way8.txt bs=1 count=0
0+0 records in
0+0 records out
0 bytes copied, 0.0352241 s, 0.0 kB/s
user@hostname:~$ truncate -s 0 way9.txt

@Gavriel770U
Copy link
Author

Additional:

user@hostname:~$ dd if=/dev/zero of=way8.txt bs=1 count=0
0+0 records in
0+0 records out
0 bytes copied, 0.0352241 s, 0.0 kB/s
user@hostname:~$ truncate -s 0 way9.txt

ok i will add them too lol thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment