གལ་ཆེའི་ཤེལ་གྱི་ཡིག་ཆའི་བཀའ་ཚིག་དེ་དག་རྒྱུན་དུ་བེད་སྤྱོད་བྱེད་ཀྱི་ཡོད།

Here is a list of some important shell commands:

—- Using Screen command
screen -ls — for a list of avaliable active screens
screen -x …. – the Name from -ls output to join to this active screen
Go out of the Screen with ‘ctrl a+d’ without stopping it

—- Harddisk and folder size
df -h – filesystemsize
du -sh * – shows the size of every folder

—- Who
whoami – list current user in current window
who – list all users logged onto the Workstation

—- Copy file to other Computer
scp filename username@ip-address:/filepath
filename is the file to copy and the rest is the Informationen for the remote Computer. You will be asked for a Password of the remote user.

—- Show Users List
cat /etc/passwd | cut -d: -f1

—- System information commands
dmesg – (for “diagnostic message”) is a command on Unix-like operating systems that prints the message buffer of the kernel. This buffer contains a variety of important messages from those printed during boot to those used for debugging software.
lspci -tv – Shows bridjes and main board
lshw – Information about installed devices
/usr/sbin/prtconf -v | more – Shows the RAM in Unix System

—- Show Linux version
uname -r
cat /proc/version

—- kill commands
kill -15 pid — is graceful Kill
kill -9 pid — is forcible Kill

—- Shows which files are open from the process
pfiles processid

—- Find a file per name
find /as -name *stat

—- Debug script
sh -x script

—- Vi commands
esc – in command mode
a – append
i – insert
q – quit
w – write
x – backspace
d – delete

shift g – springt am last line of text
:^g – list current line number
:set number – show line numbers

Cut/Paste Commands:

x – delete one character (destructive backspace)
dw – delete the current word (Note: ndw deletes n numbered words)
dd – delete the current line (Note: ndd deletes n numbered lines)
D – delete all content to the right of the cursor
d$ – same as above
:u – undo last command

Searching and Substitution commands:

/ [string] – search forward for string
? [string] – search backwards for string

Entering the Insert Mode:

i – Begin inserting text at current cursor location
I – Begin inserting text at the beginning of the current line
a – Begin appending text, one character to the right of current cursor location
shift a – Begin appending text at the end of the current line
o/O – Begin entering text one line below\above current line
ESC – Exit insertion mode and return to command mode

—- Less commands
g – go in the begining
shift g – go ende
shift 7 – Search
shift ß – Search backwards
n – go to next search match
shift n – go to before search match

—- find command
find . -name “*Sync*” -exec grep -l “501000093347053” {} \;
– finds in the current Folder all files with Name Sync, who have the string XXXX in it

—- Move files with script
ls junk* | awk ‘{print “mv “$0″ ../iraf/”$0″.dat”}’ | csh

—- Using Nohup with sqlplus
nohup sqlplus username/password @/home/sdmtest/..sql name & — the Output is in nohup.out

— remove all empty lines from a file
egrep -v ‘^$’ nohup.out > newfile.txt

—- tr command
tr [-c] [-d] [-s] [string1] [string2] output_file.txt
-c Complement the set of characters specified by string1.
-d Delete all occurrences of input characters that are specified by string1.
-s Replace instances of repeated characters with a single character.
string1 First string or character to be changed.
string2 Second string or character to change the string1.

tr -d ‘\t’ newfile — delete all Tabs from a File

—- ls commands
ls -lrt — Shows sorted file output

— show Variables value
echo $variable Name – Shows the variable
set – list of all set Variabels

—- Archivieren
tar -cf – file.dat | gzip -c > blabla.tgz — file.dat will be archived in blabla.tgz
tar -cf – * | gzip -c > blabla.tgz — all files from the Folder will be added to archive

– ཡིས་ཡིག་མཛོད་ནང་དུ་གང་ཡོད་མིན་སྟོན་གྱི་ཡོད།
གུན་ཟིཔ་ -སི་ བིལ་སི་བྷ་ཝས་.ཊི་གཛ་ | ཏར་ཊི་ཝི་ཨེཕ་ཨོ་ཛི་ཨེགསི་༠ཟི།

–ཡིས་ཡིག་ཚགས་ནང་ནས་ཡིག་ཆ་ཁ་ཤས་མ་གཏོགས་ཕྱེ་མེད།
gunzip -c ཚེས་གྲངས་མིང་ | ཏར་ -xf – དཱ་ཏེ་ནཱ་མེན་མིཏ་ཕདཌ།

– བསྡམས་སྒྲིལ་ཡག་པོ།
བྱི་ལའི་ཡིག་ཆ་༡ཡིག་ཆ་༢ | གཟིཔ་ཨོ་ཛི་ཨེགསི་༠ཟི་ཕུ།

– ཡིས་ tar.gz ཡིག་ཆའི་ནང་དོན་ཐོ་འགོད་བྱེད།
tar -ztvf ཡིག་ཆ།tar.gz
# t: ཡིག་ཚགས་ཀྱི་ནང་དོན་ཐོ་འགོད་བྱེད།
# v: ཚིག་སྦྱོར་གྱིས་ཐོ་འགོད་བྱས་པའི་ཡིག་ཆ་ལས་སྣོན་བྱས་པ། (ཞིབ་ཕྲའི་ཆ་འཕྲིན་བཀྲམ་སྟོན་བྱེད།)
# z: ཡིག་ཚགས་དེ་gzipབརྒྱུད་ནས་ཚགས་བཤེར་བྱས་ནས་ང་ཚོས་བསྡམས་པའི་(བསྡམས་པའི་).gz tarཡིག་ཆ་ཁ་ཕྱེ་ཐུབ།

—- ནང་དུ་ཆ་ཤས་ཚང་མ་ཡོད་པའི་སྣོད་ཅིག་བསྐྱར་ལོག་གིས་བསུབས་དགོས།
rm -r ཡིག་སྣོད་ཀྱི་མིང་།

— བདག་པོ་བསྒྱུར།
ls -l – སྤྱོད་མཁན་– སྡེ་ཚན་ལ་གཟིགས།
chown སྤྱོད་མཁན་:སྡེ་ཚན་ཡིག་ཆའི་མིང་།

— ཡིག་ཆ་འཛུལ་སྤྱོད་ཐོབ་ཐང་བསྒྱུར་བ།
chmod u=rwx, g=rwx ཡིག་ཆའི་མིང་།
chmod 777 ཡིག་ཆའི་མིང་།

—- དུས་རྒྱུན་གྱི་གསལ་བརྗོད་ཀྱི་དཔེ།

# smug {‘smug’ དང་མཉམ་དུ་གྲལ་རིམ་གྱི་ཡིག་ཆ་འཚོལ་ཞིབ།}
# ‘^smug’ {‘smug’ གྲལ་ཐིག་ཅིག་གི་མགོ་ལ་}
# ‘smug$’ {‘smug’ ཕྲེང་གཅིག་གི་མཇུག་ཏུ}}
# ‘^smug$’ {‘smug’ ཁོ་ན་ཡོད་པའི་གྲལ་རིམ}
# ‘\^s’ {‘^s’ ནས་འགོ་བཙུགས་པའི་གྲལ་རིམ། “\” ལས་ཐར་བར་བྱེད།}
# ‘[Ss]མུག་’ {‘Smug’ ཡང་ན་ ‘smug’ འཚོལ་ཞིབ།}
# ‘B[oO][bB]’ {BOB, Bob, BOB ཡང་ན་ BoB འཚོལ་ཞིབ། }
# ‘^$’ {ཐིག་སྟོང་འཚོལ་བ།}
# ‘[0-9][0-9]’ {ཨང་གྲངས་ཀྱི་ཨང་གྲངས་ཆ་གཅིག་འཚོལ་ཞིབ།}
# ‘[a-zA-Z]’ {ཉུང་མཐར་ཡང་ཡི་གེ་གཅིག་ཡོད་པའི་གྲལ་ཐིག་གང་རུང་ཞིག་}
# ‘[^a-zA-Z0-9] {ཡི་གེ་དང་ཨང་གྲངས་མིན་པའི་གང་རུང་ཞིག}
# ‘[0-9]\{3\}-[0-9]\{4\}’ {999-9999, ཁ་པར་ཨང་གྲངས་ལྟ་བུ་}
# ‘^.$’ {ཡིག་འབྲུ་གཅིག་ཏག་ཏག་ཡོད་པའི་གྲལ་རིམ}
# ‘”smug”‘ {‘smug’ ཚིག་བཅད་གཉིས་ཀྱི་ནང་དུ་}
# ‘”*smug”*’ {‘smug’, ཚིག་བཅད་ཡོད་མེད་}
# ‘^\.’ {དུས་ཚོད་དང་འགོ་འཛུགས་པའི་གྲལ་ཐིག་གང་རུང་ཞིག “.”}
# ‘^\.[a-z][a-z]’ {གྲལ་ཐིག་འགོ་འཛུགས་སྐབས་“.”དང་lcཡི་གེ་2ཡོད།}

—- ཡུ་ནིགསི་བཀའ་ཚིག་ཐོ་གཞུང་།
ཨོ་ཛི་ཨེགསི་༠ཟི།

“ ལ་ལན་གཅིག

  1. འགྲེལ་བརྗོད་བྱེད་སྟངས་ཡག་པོ་དང་། ངའི་གསལ་བཤད་ཀྱི་བརྗོད་གཞིའི་འབྲེལ་ཡོད་གནས་ཚུལ་བསྡུ་རུབ་བྱེད་པའི་རྩོམ་ཡིག་ཡག་པོ།
    ངས་སློབ་གླིང་དུ་བརྒྱུད་སྤྲོད་བྱེད་རྒྱུ་ཡིན།

ལན་ཞིག་བཞག་རོགས།