📘Cisco DevNet Associate (200-901 DEVASC)
1. Bash Commands for Directory Navigation
In Linux or macOS (and Windows via WSL or Git Bash), Bash is a command-line shell used to interact with the operating system. One common task is navigating directories (folders).
Important Commands
| Command | Description | Example |
|---|---|---|
pwd | Print Working Directory – shows your current location in the file system | $ pwd → /home/user/projects |
ls | List files and folders in the current directory | $ ls → app.py config/ README.md |
ls -l | Lists files with details like permissions, owner, size, date | $ ls -l → shows a table with details |
cd <directory> | Change directory | $ cd projects moves into the projects folder |
cd .. | Move up one directory level | If in /home/user/projects, $ cd .. → /home/user |
cd ~ or just cd | Go to home directory | $ cd ~ → /home/user |
tree | Shows the directory structure visually (may need sudo apt install tree) | $ tree → shows nested files/folders |
Tip for exams: Understand the difference between absolute paths (
/home/user/projects) and relative paths (../projects).
2. Bash Commands for File Management
Managing files is essential in development environments. Here are the key commands:
| Command | Description | Example |
|---|---|---|
touch <filename> | Create an empty file | $ touch test.txt → creates test.txt |
mkdir <dirname> | Create a new folder | $ mkdir logs → creates logs folder |
cp <source> <destination> | Copy file or folder | $ cp test.txt backup.txt → copy file$ cp -r logs backup_logs → copy folder recursively |
mv <source> <destination> | Move or rename a file/folder | $ mv test.txt old_test.txt → rename$ mv test.txt ../ → move to parent directory |
rm <filename> | Remove (delete) a file | $ rm old_test.txt |
rm -r <dirname> | Remove a folder and its contents | $ rm -r logs |
cat <filename> | Display the content of a file | $ cat config.txt → shows file content |
less <filename> | View content of a file page by page | $ less config.txt |
head <filename> | Show first 10 lines | $ head config.txt |
tail <filename> | Show last 10 lines | $ tail log.txt |
nano <filename> | Open a file in a simple text editor | $ nano config.txt |
Tip for exams: Know when to use
-r(recursive) and the difference betweenmvandcp.
3. Bash Commands for Environmental Variables
Environmental variables store information that programs or scripts use. For example, they can store user information, system paths, or configuration values.
Key Commands
| Command | Description | Example |
|---|---|---|
echo $VAR_NAME | Display the value of an environment variable | $ echo $HOME → /home/user |
export VAR_NAME=value | Set a temporary environment variable | $ export PROJECT_DIR=/home/user/projects |
env or printenv | Show all environment variables | $ env → displays HOME, PATH, etc. |
unset VAR_NAME | Remove an environment variable | $ unset PROJECT_DIR |
PATH variable | Stores directories to search for executable programs | $ echo $PATH → /usr/local/bin:/usr/bin:/bin |
Tip for exams: Know that environment variables can be temporary (only for the session) or permanent (set in
.bashrcor.bash_profile).
4. Real-Life IT Example Usage
In a DevOps or software development environment:
- Directory navigation: Move between project folders to edit code or view logs.
- File management: Create configuration files (
config.yaml), move logs to backups, or delete temporary files. - Environment variables: Store API keys or project paths temporarily for scripts without hardcoding them in the code.
Example:
export API_KEY=abc123
echo $API_KEY
python app.py
unset API_KEY
This ensures sensitive information is not saved permanently on the system.
5. Exam Tips for 200-901 DEVASC
- Be able to list, navigate, and manipulate files and directories using the basic commands.
- Understand relative vs absolute paths.
- Know how to set, view, and remove environment variables.
- Remember
ls,cd,mkdir,rm,cp,mv,touch,export,echo— these are frequently tested. - Practice using the terminal because hands-on knowledge makes it easier to answer scenario-based questions.
