Create a temp file in Linux
Answer:
To create a temp file in Linux, you can use the mktemp command
E.g.
# mktemp foo.XXXXXXXXXXX
foo.aAIYdsa5027
mktemp will replace XXXXX... by random characters and create that temp file for you.
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
Create a temp file in Linux
Answer:
To create a temp file in Linux, you can use the mktemp command
E.g.
# mktemp foo.XXXXXXXXXXX
foo.aAIYdsa5027
mktemp will replace XXXXX... by random characters and create that temp file for you.
Using system directory stack with pushd & popd
Answer:
When you need to changes a lot of directory frequently, pushd & popd can be very useful
E.g.
john@localhost:/tmp $ pushd /home/jack/
# change to /home/jack/ and push to the stack
/home/jack /tmp
john@localhost:/home/jack $ pushd /home/mark/
# change to /home/mark/ and push to the stack
/home/mark /home/jack /tmp
john@localhost:/home/mark $ popd
# pop current directory and change to /home/jack
/home/jack /tmp
john@localhost:/home/jack $ popd
# pop current directory and change to /tmp
john@localhost:/tmp/ $
List file by date
Answer:
When you directory contains lot of file, it is better to list them and sort by date
E.g.
# ls -lrt
Search the manual pages's description
Answer:
Every manual page has a short description, apropos searches the descriptions for instances of keyword.
# apropos gunzip
gunzip (1) - compress or expand files
You can also use the man command for this purpose.
Create an empty file in Linux
Answer:
Besides using the touch command, any easy tricks is to use the > redirection, e.g.
# > test.txt
Easy enough?