- Shuffle
Toggle OnToggle Off
- Alphabetize
Toggle OnToggle Off
- Front First
Toggle OnToggle Off
- Both Sides
Toggle OnToggle Off
Front
How to study your flashcards.
Right/Left arrow keys: Navigate between flashcards.right arrow keyleft arrow key
Up/Down arrow keys: Flip the card between the front and back.down keyup key
H key: Show hint (3rd side).h key
![]()
PLAY BUTTON
![]()
PLAY BUTTON
![]()
130 Cards in this Set
- Front
- Back
|
|
|
|
|
|
|
How to ignore cases in grep?
|
grep -i foo
|
|
Disk space for a folder
|
du $folder | grep total
|
|
Disk free space
|
df -h \tmp
|
|
Which shell are you using?
|
echo $SHELL
or echo $shell |
|
How do you grep a string?
|
grep foo
|
|
How do you see an output with less?
|
env | less
|
|
Check all environmental variables?
|
env
|
|
Make a variable available to other programs in your environment.
|
export VARIABLE
or export VARIABLE=3 |
|
Syntax difference between:
export and setenv |
export key=value
setenv key value |
|
Shells use:
export and setenv |
sh and ksh: export
csh and tshell: setenv |
|
View all files in a folder with ".txt" suffix.
|
ls /dir/*txt
|
|
List files per modification time.
|
ls -lt
|
|
Put a job in the background (automatically run last suspended job)
|
ctrl -z
bg |
|
Put a job in the foreground.
|
fg
|
|
Clean the terminal.
|
ctrl + l
clear |
|
Shutdown machine.
|
shutdown
|
|
Display current tasks executed by the Linux kernel.
|
top
|
|
Suspend a process.
|
ctrl + z
|
|
Kill a process.
|
ctrl + c
or kill 12 |
|
Where is a command located?
|
tcsh: where fsl
bash: which fsl |
|
Set a variable to a new value.
|
VAR=3
|
|
The last commands that I typed.
|
history
|
|
First element of a an array in Bash.
|
Indexed by 0.
|
|
Declare an array.
|
declare -a ARRAY
|
|
Assign a list of variables to an array.
|
ARRAY=(v1 v2 ... vn)
|
|
Combine declaration and assignment of an array.
|
declare -a ARRAY=(v1 v2 ... vn)
|
|
Read content of an array.
|
echo ${ARRAY[*]}
|
|
Assign value to any array's location.
|
ARRAY[10000]=vinf
|
|
Delete element of an array.
|
unset ARRAY[1]
|
|
Number of lines in a file.
|
wc -l $FILE
|
|
Number of words in a file.
|
wc -w $FILE
|
|
Use the result of a command for sthg else.
|
echo $(head -n $i $FILE | tail -n 1)
|
|
List directories only.
|
ls -l | grep ^d
|
|
Concatenate strings $file and .txt?
|
echo ${file}.txt
|
|
Padding with 0.
|
printf %0${MAXLEN}d $NUM;
|
|
RAM usage.
|
free -m
|
|
Exit a program.
|
exit
|
|
Return code for a success.
|
0
|
|
Return code(s) for a failure.
|
All n>0.
|
|
How to find a string in a set of files.
|
grep -R string /folders/
|
|
Emacs: Get info about current mode.
|
M-x describe-mode
|
|
Emacs: Get ALL keybindings.
|
Help Menu: Describe: All Keys.
|
|
Syntax for conditional.
|
if [ $F == "$f ]; then ...; fi
|
|
Space between if, while, or do and condition.
|
while [ "$i" -le "$nFILES" ]; do
|
|
Value in a conditional.
|
if [ $var != "value" ]
|
|
Space between variables and operator.
|
if [ $V1 == $V2 ];
|
|
Separator in an array of values.
|
ARR=(V1 V2 V3)
|
|
Formulate a mathematical expression.
|
expr 4 '+' 6
|
|
Signs to isolate a command.
|
`command`
|
|
Signs to enter a value.
|
"value"
|
|
Signs for BASH protected symbols.
|
'+'
|
|
Length of a string.
|
echo ${#FILE}
|
|
End of a string after the nth position.
|
echo ${FILE:n}
|
|
Redirect by appending.
|
cmd >> output
|
|
Redirect to new file.
|
cmd > output
|
|
Test a condition (COMMAND).
|
test 10 -lt 5
|
|
TRUE (exit status).
|
0
|
|
FALSE (exit status).
|
1
|
|
What is [
|
It is a command, and should be followed by a space.
|
|
Test a condition (BRACKETS).
|
[ 10 -lt 5 ]
|
|
Exit status of last command.
|
echo $?
|
|
Read the third column of a table.
|
awk '{print $3}' ROI_MNI_V4.txt
|
|
Total size of a file.
|
stat -c%s foo
|
|
What is the first line in a file?
|
Line 1.
$i=1 |
|
Exit code if no exit function?
|
0 by default.
|
|
Looping through a vector.
|
for FILE in ${FILES[*]}; do
done |
|
Check whether an expression is false.
|
[ ! 5 -le 5 ]
|
|
Is expr AND expr true?
|
if [ expr ] && [ expr ];
|
|
Is expr OR expr true?
|
if [ expr || expr ];
|
|
If file exists.
|
if [ -f $FILE ]; then
|
|
Update an index.
|
let t=t+1
|
|
Code for standard INPUT.
|
0
|
|
Code for standard OUTPUT.
|
1
|
|
Code for standard ERROR.
|
2
|
|
What is the standard output.
|
The shell or screen.
|
|
Open file in std output.
|
cat file
|
|
List files containing "string".
|
ls -l *string*
or ls -l | grep string |
|
Time a command.
|
time cmd
|
|
Submit a job and then leave a server.
|
bg
exit |
|
Requirements for remote login.
|
Need a fix IP address.
|
|
Unzipping any files.
|
gunzip foo
|
|
GNU zipping or compression.
|
gzip foo
|
|
Tarball and zip entire folder.
|
tar cvz -f foo.tar.gz foo
|
|
Contracted extension for .tar.gz
|
.tgz
|
|
Untar and unzip an archive.
|
tar xvz -f foo.tar.gz
|
|
Kill a job [command line].
|
kill %1
|
|
What is qsub for?
|
Submit batch job to Grid Engine.
|
|
How to use qsub?
|
qsub -q rhe5b -b y -N foo bash ~/foo.sh
|
|
Display groups (per cluster) queues.
|
qstat -g c
|
|
GUI interface for GRID Engine.
|
qmon
|
|
Queue stat for my jobs.
|
qstat -u user
|
|
Delete a job in the queue.
|
qdel -f job-ID
|
|
Process(es) Status.
|
ps aux
|
|
Does a directory exists?
|
[ -d $folder ];
|
|
Print columns 1 and 2.
|
awk '{print $1,$2}' foo.txt
|
|
Add a column of zero and boudiou.
|
awk '{print 0,"bingo",$0}'
|
|
What is $0 in awk?
|
All the fields.
|
|
Find and replace with awk.
|
awk -v var=cool '{ gsub(/crap/,var,$0); print }' foo.txt
|
|
Find and replace with awk (Two variables)
|
awk -v V1=crap -v V2=cool '{ gsub(V1,V2,$0); print }' foo.txt
|
|
Install a software.
|
sudo apt-get install foo
|
|
Re-install a software.
|
sudo apt-get --reinstall install foo
|
|
Upgrade all softwares.
|
sudo apt-get upgrade
|
|
Upgrade distribution.
|
sudo apt-get dist-upgrade
|
|
Which Linux version?
|
uname -a
|
|
List of printers.
|
lpstat -a
|
|
Alternative to SAMBA for printing.
|
lpd:://
|
|
Editing windows in Gnome.
|
gconf-editor -> metacity
|
|
aliases?
|
alias
|
|
Use ImageMagick for convertion.
|
convert img.png img.ps
|
|
Queues for all users on SGE.
|
qstat -u "*"
|
|
Deleted Files on BRC-MH.
|
cd .snapshot
|
|
Change both ownership and group.
|
chown cgineste:cgineste foo
|
|
Globbing?
|
Use of wildcards.
|
|
All .pdf files starting with a capital letter.
|
[A-Z].pdf
|
|
All .pdf files whose name is any character.
|
?.pdf
|
|
Change to the previous directory.
|
cd -
|
|
Recursively list current directory.
|
ls -R
|
|
List files in reverse time order.
|
ls -rt
|
|
Remove a directory.
|
rmdir myDir
|
|
Make subdirectory even if directory doesn't exist.
|
mkdir -p myDir/subDir
|
|
What other signs can replace the d in drwxrwx---
|
- for a file
l for a link. |
|
Recursively assign permissions in a directory.
|
chmod -R myDir
|
|
Print only the FIRST 100 lines of a file.
|
head -100 myfile.txt
|
|
Print the LAST 100 lines of a file.
|
tail -100 myfile.txt
|
|
Continuously update the last lines of a file.
|
tail -f mylog.txt
|
|
Display Linux tasks.
|
top
|
|
Show all the processes a user is running.
|
ps -fu cgineste
|