#1 viewing content of file with cat command
#2 creating a file with cat command
listen 127.0.0.1:80;
server_name 127.0.0.1;
location /nginx_status {
stub_status on;
allow 127.0.0.1;
deny all;
}
}
#3 cat command reading file with line numbers & sorting
Display along with numbers of line
Display $ at the End of every line with -e option
Multiple Files at Once (semi colons required)
#4 Overwriting existing file with cat command
Appending(Standard Output with Redirection Operator)
#5 appending at end of existing file with command ft ssh authorizedkeys
Redirecting Standard Input with Redirection Operator
#6creating single file from multiple files
#7 Sorting Contents of Multiple Files in a Single File
#8 creating file & writing data cat eof to file
cat >/etc/nginx/sites-enabled/newserver.conf<<EOF
server {
listen 80;
root /var/www/html/;
server_name _;
include /etc/nginx/conf.d/global.config;
}
EOF
it will creates a file newserver.conf in the prescribed path.
2nd
it adds content to file with eof command in linux shell script.
EOF (end-of-file)
touch command only to create a file
Nano file editor
Vim editor
writting to files with echo command
to create a file
echo > phpinfo.php
or
echo > /var/www/html/phpinfo.php
write/print the words to document
echo “phpinfo();” > phpinfo.php