Linux Essential Commands and Vi/Vim Editor Quick Reference

Chip Development Environment

Key tools for chip developmant include:

  • Linux/Unix operating system
  • EDA tools with TCL scripting
  • SVN/GIT for version control
  • Makefile build scripts
  • Perl/Python scripting languages
  • Vim/Gvim text editors

Basic Linux Commands

User and System Information

who              # Display users currently logged in
whoami           # Show current user
which gvim       # Locate gvim installation path
pwd              # Print working directory
df -h            # Show disk usage in human-readable format
top              # Display system load and running processes

Path Concepts

Symbol Meaning Type
/ Root directory (first psoition) or separator Absolute path
~ Current user's home directory Absolute path
. Current directory Relative path
.. Parent directory Relative path
../.. Two levels up Relative path

Directory Navigation

cd subdir           # Enter subdirectory
cd ../dirname      # Move to parent directory's subfolder
cd -               # Return to previous location
ls                 # List directory contents
ls -a              # Show hidden files (starting with .)
ls -l              # Detailed listing (alias: ll)
ll -a              # Detailed listing with hidden files
ls -R              # Recursive directory listing
ll -h              # Human-readable file sizes

File colors: green = executable, white = regular file, blue = directory

File and Directory Operations

mkdir project          # Create directory
mkdir project/lib      # Create nested directory
touch file1 file2      # Create multiple files

rm filename           # Remove file (confirm prompt)
rm -f directory       # Force remove without prompt
rm -r directory       # Remove recursively (with prompts)
rm -rf directory      # Force recursive removal

mv oldname newname    # Rename file
mv file /path/        # Move file to destination
mv src dest           # Move with overwrite prompt

cp -rf src dest       # Copy files recursively
cp -rf src/* dest/    # Copy contents of directory

Directory Tree Display

tree              # Show directory structure
tree -C          # Colored output

File Types and Permissions

File Type Indicators

  • - : Regular file
  • d : Directory

Permission Notation

r = readable (4)
w = writable (2)
x = executable (1)

Three permission sets: owner | group | others

chmod 755 filename    # rwxr-xr-x (common for scripts)
chmod 700 filename    # rwx------ (owner only)
chmod 777 filename    # rwxrwxrwx (everyone full access)

Archive Operations

tar cf archive.tar files    # Create archive
tar xf archive.tar         # Extract archive

Shell Shortcuts and Tips

↑                      # Recall previous command
history                # Show command history
cd prefix + Tab        # Autocomplete directories starting with prefix
clear                  # Clear terminal screen
Ctrl+I                 # Show available files in current path
Middle mouse click    # Paste selected text

Search Commends

grep -rn "pattern"           # Recursive search with line numbers
grep -l "pattern"           # List files containing pattern
grep -i "pattern"           # Case-insensitive search
grep -c "pattern" file      # Count occurrences

Symbolic Links

ln -s /path/to/target linkname     # Create symbolic link
ln -snf /new/target linkname       # Modify existing link
unlink linkname                    # Remove link

Terminal and Simulation Tips

konsole &              # Open new terminal at current path
Ctrl+C                # Interrupt frozen simulation
next                  # Find deadlock point (in ucli% mode)
help                  # Show available commands

Vi/Vim Editor

Editor Variants

  • vi - Basic text editor
  • vim - Enhanced text editor (terminal)
  • gvim - GUI version (opens new window)

Insert Mode Commands

Command Action
i Insert before cursor
a Insert after cursor
o New line below

Normal Mode Navigation

h       # Move left
j       # Move down
k       # Move up
l       # Move right

0       # Move to line start
$       # Move to line end
Ngg     # Jump to line N

File Navigation

gf              # Open file under cursor
Ctrl+O          # Return to previous file

Search and Replace

/pattern        # Search forward
?pattern        # Search backward
Shift+3         # Highlight all occurrences of word under cursor
:noh            # Remove highlighting

:set nu         # Show line numbers
:set nonu       # Hide line numbers

:%s/old/new     # Replace all occurrences

Editing Commands

yy          # Yank (copy) current line
p           # Paste below cursor
dd          # Delete current line

Visual Block Mode (Multi-line Editing)

  1. Press Ctrl+v to enter Visual Block mode
  2. Use arrow keys to select lines
  3. Press Shift+i to enter insert mode
  4. Type the changes
  5. Press Esc to apply to all selected lines

Editor Configuration

Customize Vim/Gvim by editing configuration files:

  • ~/.vim - Vim plugins and runtime files
  • ~/.vimrc - Vim configuration settings

Example .vimrc Settings

set number
set tabstop=4
set shiftwidth=4
set expandtab
syntax on

Shell Configuration

The ~/.cshrc file configures C shell environment. Customize aliases, environment variables, and shell behavior:

alias ll 'ls -l'
alias la 'ls -a'
setenv PATH /tools/bin:$PATH

Tags: Linux Command Line Vi Editor Vim Shell

Posted on Thu, 07 May 2026 01:39:45 +0000 by atwyman