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.
How to get the PID in current bash shell script
Answer:
Use the special variable $$, you can get the PID (Process ID) of the current bash shell script
#/bin/bash
echo $$;
The above script will print the PID to the standard out.
Serve current directory using HTTP with a single command
Answer:
Sometimes, you want to share some files in a given directory in your Linux system to other people, you might consider setup a NFS, Samba, FTP or so.
However, the easiest method is to export the directory using HTTP, with the help of Python.
E.g.
# cd /data/
python -m SimpleHTTPServer
Serving HTTP on 0.0.0.0 port 8000 ...
Now people can access the web server at port 8000 of your system's IP address, to access the /data directory.
Visual Shell for Linux
Answer:
GNU Midnight Commander is a directory browser/file manager for Unix-like operating systems, you can use it to browser shell, ftp, tar and more.
To install in Ubuntu,
# sudo apt-get install mc

Reference:
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/ $