Linux For Beginners
Published:
This paper summarizes some common and basic usages of Linux. The information is only suitable for beginners.
Overview
Linux Test
How To Start
- If you are using Windows OS, you can access to the remote server by
- Putty
- MobaXterms (recommended)
- How to configure Putty & Xming (on your laptop) from University of California, Irvine
- Basic Commands
cd
,ls
,mkdir
,pwd
,cat
,grep
,sudo
Common Usage
- Ubuntu Documentation on How to Use the Terminal
- Graphic Notebook Editor
- Command:
gedit file_name.extension
- Command:
vim
getting started- Display information of your active processes.
- Command:
ps -ef | grep loginname
Orps -ef | grep first_7_characters_of_your_loginname_if_it_is_longer_than_8_characters
- Command:
- Kill A Process
- Command:
kill PID
- Command:
Copy all the contents of ~/folder1 to ~/new_folder1:
cp -r ~/folder1/. ~/new_folder1
- Module
- Check available modules:
module avail
- Check loaded modules:
module list
- Load a module:
module load apps/MATLAB/R2020a
- Unload a module:
module unload apps/MATLAB/R2020a
- Check available modules:
Running Matlab Remotely in a Server
Step 1: Load Matlab
- Command:
module load apps/MATLAB/R2020a
Step 2: Run Matlab without GUI and in the background
- Command:
nohup matlab -r MatlabScriptName -nodisplay - nosplash -nojvm -nodesktop &
The above command may output Bad file descriptor and Warning: “Error reading Character from command line” error. In this case, using the following command instead:
nohup matlab -nodesktop -nosplash -nodisplay < main.m >log.txt 2>&1 &
Explanation: https://www.programmersought.com/article/91451058498/
“>log.txt” refers to redirecting the output to log.txt. 2>&1 means to input the error information into log.txt, 2 Refers to the standard input and output error (stderr), 1 refers to the standard output (stdout), 2> & 1 means 2 is equivalent to 1 output, the last & is the meaning of background operation, combined with the nohup command.
Tutorial:
- How to run Matlab on server, University of Calgary
- How do I run my program in the background (including the use of ‘screen’)?, University of California, Berkeley