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 – Meklēt
shift ß – Meklēt atpakaļ
n – pāriet uz nākamo meklēšanas atbilstību
shift n – dodieties uz pirms meklēšanas atbilstības
—- atrast komandu
atrast. -nosaukums “*Sync*” -exec grep -l “501000093347053” {} \;
– atrod pašreizējā mapē visus failus ar nosaukumu sinhronizāciju, kuros ir virkne XXXX
—- pārvietojiet failus ar skriptu
ls junk* | awk ‘{print “mv “$0″ ../iraf/”$0″.dat”}’ | csh
—- Nohup izmantošana ar sqlplus
nohup sqlplus lietotājvārds/parole @/home/sdmtest/..sql nosaukums & — izvade atrodas nohup.out
— noņem no faila visas tukšās rindas
egrep -v ‘^$’ nohup.out > newfile.txt
—- tr komanda
tr [-c] [-d] [-s] [string1] [string2] output_file.txt
-c Papildiniet ar string1 norādīto rakstzīmju kopu.
-d Dzēsiet visus ievades rakstzīmju gadījumus, kas norādīti string1.
-s Aizstāt atkārtotu rakstzīmju gadījumus ar vienu rakstzīmi.
string1 Pirmā virkne vai rakstzīme, kas jāmaina.
string2 Otrā virkne vai rakstzīme, lai mainītu virkni1.
tr -d ‘\t’ jauns fails — izdzēst visas cilnes no faila
— - ls komandas
ls -lrt — Rāda sakārtoto failu izvadi
— parāda mainīgo vērtību
echo $mainīgais Nosaukums – Parāda mainīgo
iestatīt – visu komplektu mainīgo sarakstu
—- Arhivētājs
tar -cf – file.dat | gzip -c > blabla.tgz — fails.dat tiks arhivēts mapē blabla.tgz
darva -cf – * | gzip -c > blabla.tgz — visi faili no mapes tiks pievienoti arhīvam
– Parāda arhīvā esošo saturu bez izsaiņošanas
gunzip -c blsbvs.tgz | tar tvf –
– no arhīva izpako tikai dažus failus
gunzip -c datejname | tar -xf – dateinamen mit pfad
– labāka kompresija
kaķa fails1 fails2 | gzip > foo.gz
– uzskaita tar.gz faila saturu
tar -ztvf fails.tar.gz
# t: norādiet arhīva saturu
# v: detalizēts apstrādāto failu saraksts (parādīt detalizētu informāciju)
# z: filtrējiet arhīvu, izmantojot gzip, lai mēs varētu atvērt saspiestu (atspiest) .gz tar failu
—- rekursīvi izdzēsiet mapi ar visiem tajā esošajiem elementiem
rm -r mapes nosaukums
— mainīja īpašnieku
ls -l – skatīt lietotāju – grupu
chown user:group faila nosaukums
— mainīt faila piekļuves tiesības
chmod u=rwx, g=rwx faila nosaukums
chmod 777 faila nosaukums
—- Regulāro izteiksmju piemēri:
# pašapmierināts {meklējiet failus rindām, izmantojot ‘smug’}
# ‘^smug’ {‘smug’ rindas sākumā}
# ‘smug$’ {‘smug’ rindas beigās}
# ‘^smug$’ {rindas, kurās ir tikai ‘smug’}
# ‘\^s’ {rindas, kas sākas ar ‘^s’, “\” izceļas no ^}
# ‘[Ss]mug’ {meklējiet ‘Smug’ vai ‘smug’}
# ‘B[oO][bB]’ {meklējiet BOB, Bob, BOb vai BoB}
# ‘^$’ {meklējiet tukšas rindiņas}
# ‘[0-9][0-9]’ {meklējiet ciparu ciparu pārus}
# ‘[a-zA-Z]’ {jebkura rindiņa ar vismaz vienu burtu}
# ‘[^a-zA-Z0-9] {viss, kas nav burts vai cipars}
# ‘[0-9]\{3\}-[0-9]\{4\}’ {999-9999, piemēram, tālruņa numuri}
# ‘^.$’ {rindiņas ar tieši vienu rakstzīmi}
# ‘”smug”‘ {‘smug’ dubultpēdiņās}
# ‘”*smug”*’ {‘smug’, ar vai bez pēdiņām}
# ‘^\.’ {jebkura rindiņa, kas sākas ar punktu “.”}
# ‘^\.[a-z][a-z]’ {rindiņa sākas ar “.” un 2 lc burtiem}
—- Unix komandu saraksts
http://www.computerhope.com/unix.htm

Atstājiet atbildi