xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

Linux shell create file methods

touch, cat, echo, EOF

touch

$ touch file.py

$ touch file1.txt file2.txt file3.txt

$ > empty_file.md

cat

$ cat > file.md

Heredoc

$ cat << EOF > file1.txt
Some line
Some other line
EOF

echo

$ echo "Some lines" > file.md

$ echo file.md

EOF

$ cat > test.py <<EOF
# coding: utf8

__author__ = 'xgqfrms'
__editor__ = 'vscode'
__version__ = '1.0.1'
__copyright__ = """
  Copyright (c) 2012-2050, xgqfrms; mailto:xgqfrms@xgqfrms.xyz
"""
EOF

dd

$ dd if=/dev/zero of=1G.test bs=1 count=0 seek=1G

fallocate

$ fallocate -l 1G 1G.test

refs

https://linuxize.com/post/create-a-file-in-linux/


Flag Counter

©xgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!


原文地址:https://www.cnblogs.com/xgqfrms/p/13461212.html