
Useful Linux Commands for AI Development Series #1 (Basic)
The Linux command line is a text interface to your computer. Often referred to as the shell, terminal, console, prompt or various other names, it can …
In Series #1 (Basic) , we have walked through some useful commands for topics such as File System Basics, File System Permission & Ownership, SSH (Remote Control), and Monitor System Loads (CPU, GPU, Memory). Let’s walk through more in this article.
There are two types of links: hard link & symbolic link. Hard link refers that users may create multiple names for a linked file. Whereas, software only allows the user to create one particular link, which directly points to another directory that differs from the original directory. This technique is frequently used in linking the default environment packages such as OpenCV library to a virtual environment library.
On Unix-like operating systems, the ln command creates links between files, associating file names with file data. More info here .
1# Syntax:
2# ln [option] [original-file] [target-file-or-folder]
3# Parameters:
4# -b delete,overwrite the existing links
5# -d allow users to make hard link
6# -f force execute
7# -i interchangeable mode, if the file already exists, then asks if users want to overwrite
8# -s symbolic link
9# -v show the process
10$ ln -s path/[original-file] path/[target-file-or-folder]
The screen application is very useful if you are dealing with multiple programs from a command-line interface and for separating programs from the terminal shell. It also allows you to share your sessions with other users and detach/attach terminal sessions.
1Ctrl + L
1# Create a new screen session
2$ screen -S screen_name
1# List the available screen sessions
2$ screen -list
1# Reattach to this screen session
2$ screen -r screen_name
1# Kill a screen session
2$ screen -S screen_name -X quit
pip
is a package manager for Python packages, or modules if you like.
1$ sudo apt install python3-pip
2$ sudo -H pip3 install --upgrade pip
1$ pip install package-name
1$ pip list
1$ pip show package-name
1$ which python
2$ which pip
Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals.
1# Set up the config file for furture useage
2$ git config --global user.name Your Name
3$ git config --global user.email email@example.com
4# Note: --global refers that the config file will be applied to all the repos on your device.
1$ ssh-keygen -t rsa -C email@example.com
2# Log in to your Github page, open up Account Settings >> SSH and GPG keys >> Add SSH keys,
3# Paste your the content inside your id_rsa.pub file to the block
4# Give it a title
1# Initialize a repo
2$ git init
3
4# Add a file to the repo
5$ git add filename.ext
6# Add all files to the repo
7$ git add *
8#OR
9$ git add --all
10
11# Commit changes
12$ git commit -am 'custom-msg'
13
14# Build a remote connection
15$ git remote add origin https://github.com/username.git
16
17# Remove the connection
18$ git remote rm origin
19
20# Sync the local repo to Github (Cloud Server)
21$ git push origin master
22# you may change master with your custom branch
23
24# Check repo status
25$ git status
1$ git clone https://github.com/username.git
2# If you want to rename the repository, you may do
3$ git clone https://github.com/username.git new_repo_name
1# Get updates of the repo from your contributor
2$ git pull
If you have already walked through all the commands above, let’s move forward to the advanced commands tutorial at Series #3 (Advanced) . Happy Coding !
The Linux command line is a text interface to your computer. Often referred to as the shell, terminal, console, prompt or various other names, it can …
In the summer of 2022, I decided that it was time to try again to learn a bit about Kubernetes because it’s something that becomes more and more …