Module 68 min

Permissions, Processes, and Environment

chmod, ps, kill, and PATH

A few more essentials round out a working engineer toolkit: controlling who can run a file, managing running programs, and setting up your environment so the tools are found.

Permissions

Every file has permissions for read, write, and execute. You will mostly need to make a script executable.

bash
chmod +x run_flow.sh     # make a script executable
./run_flow.sh            # run a script in the current directory

Processes

A long tool run is a process. Sometimes you need to see what is running or stop something.

bash
ps -ef | grep dc_shell   # find your running tool process
top                      # live view of CPU and memory use (q to quit)
kill 12345               # stop a process by its PID
kill -9 12345            # force-stop one that will not exit

Environment and PATH

The shell finds commands by looking through the directories listed in the PATH variable, and tools are configured through environment variables. Your login files set these up.

bash
echo $PATH               # the directories the shell searches
echo $HOME               # your home directory
export TOOL_ROOT=/tools/synopsys   # set an environment variable
which dc_shell           # show which command will actually run
source ~/.bashrc         # re-read your shell setup after editing it
Pro tip

when a tool "command not found" even though it is installed, the cause is almost always PATH. Check with which and echo $PATH, then source the setup script that adds the tool to your PATH. This one piece of knowledge solves a huge share of fresher setup problems.

Watch out

changes you make to PATH or variables in one terminal do not affect other terminals, and are lost when you close it unless you add them to your ~/.bashrc (or the site setup file). If a setting "disappears," that is why.