1.1. Linux Quick Start Guide¶
1.1.1. Setup¶
To add python to PATH:
export PATH="/C/Users\vkisf\AppData\Local\Programs\Python\Python38:$PATH"To add python scripts (pytest etc.) to PATH:
export PATH="/C/Users\vkisf\AppData\Local\Programs\Python\Python38\Scripts:$PATH"To add java to PATH:
export PATH="/C/Users/vkisf/AppData/Local/Programs/AdoptOpenJDK/jdk-11.0.8.10-hotspot/bin:$PATH"To set an alias: ``alias python38=”winpty /C/UsersvkisfAppDataLocalProgramsPythonPython38python.exe”
To ssh:
alias ssh_server1="ssh username@servername.com"
1.1.2. General¶
To clear terminal window text:
clearTo copy text from terminal: simply highlight the text
To paste text into terminal:
Shift+InsertTo change directories:
cd folder1/folder2To back out a directory:
cd ..then back out 2 and so on:cd ../..To back out to home directory:
cd ~To create a directory:
mkdir folder1To create a file:
touch file.txtTo concatenate 2 files:
cat file1.txt file2.txt > file2.txtPipe to a file:
>To append to a file:
>>
To to print file content to terminal:
cat file1.txtTo execute a file:
./file1.txtTo remove a file:
rm file1.txtTo remove all files under a folder:
rm -rf folder1To remove a folder:
rmdir folder1To rename a file/folder:
mv file1.txt file2.txtTo get current working directory:
pwdTo get list of files/folders in your current working directory:
dir -laorls -la(-l for long desc, -a for hidden)To search for text in files/folders:
grep -r "text" *(the “*” is a wild card)
1.1.3. File Permissions¶
To get list of files/folders with permission levels in your current working directory:
dir -laTo change file/folder permissions:
chmod -R u=rwx folder-Ris recursively change all files/folder under the given folderuis for “user”,gfor “group”,ofor “other” andafor “all”rfor “read”,wfor “write”,xfor “execute”
To change group of a file/folder:
chgrp new_groupname file.txtTo check which groups you belong to:
groups
1.1.4. Scripting¶
To print datetime:
date +%m%d%y(note lower case is short form, upper case is long form)To declare a variable in a script:
variable1 = "this"and to call it$variable1