Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Linux Commands

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 5

Linux commands

-------------------
gireeshdarshi
akhil123

Basic
--------
pwd-present working directory
cd-change directory
ls -ltr-->list of files
ls -altr -->display the hidden files
clear-->clears the screen
cd -->comes back to home location
cd ..-->comes a step back
cd ../.. -->comes two steps back
ls -->list of files in that directory
echo - print particular values
mkdir test-create a folder
touch rrr.txt-used to create empty files
cat rrr.txt -->To view the data
vi rrr.txt -->press esp+i -->edit or insert data in the file -->esc+shift+:+wq to
exit
cat -n rrr.txt --->To get data row wise
wc -l rrr.txt --->displays count,no.of rows,file name
cat rrr.txt|wc -l -->returns no.of rows
du -ah|sort -rh|head -1 -->largest file in the directory
rev filename|cut -c -->print the last character from every record in file

sed commands - To perform row operation


--------------
sed -n 3p rrr.txt -->returns 3rd record to o/p
sed -n 3,4p rrr.txt -->returns 3,4th records to o/p
sed -n -e '1p' -e '7p' rrr.txt ->returns 1 and 7 records
sed 's/ganga/pavan/G' rrr.txt ->replaces the name ganga with pavan
sed -e '1d' -e '$d' rrr.txt ->deletes 1st and last record
sed -n 2,3psed -n rr.txt -->displays the 2nd and 3rd record
sed '1d' rr.txt -->deletes the first record and displays the other records to
output
sed 's/rama/mani/G' rr.txt -->replaces the name rama with mani
sed '1,3s/rama/mani/' rr.txt -->replaces the name rama with mani which is present
in 1 to 3 records
sed '/^$/d'| sort -u emp.txt - remove the empty lines

grep commands - To search particular pattern


--------------
grep -->used for searching single string
grep -e 'ganga' -e 'ranga' rr.txt -->used for searching multiple strings
grep 'ganga' rr.txt -->highlights the word in the list
grep -i 'ganga' rr.txt -->highlights the capital or small word in the list
grep -v 'ganga' rr.txt -->skipping the particular string in the list
grep -c 'ganga' rr.txt -->gives the count of the word in the list
grep -o 'ganga' rr.txt -->highlight the particular word
ls -ltr|grep '^dr' -->starting with dr
grep -ri 'hello' directory path
555-read & execute

777-full access
head & tail commands - Top & Bottom records
----------------------
head -6 rrr.txt|tail -1 ->returns 6th record
head -3 rr.txt > save.txt -->select & save the given data in the other given file.
tail -2 rr.txt >> save.txt -->appends the records to save.txt
tail -2 rr.txt > save.txt -->overrides the records to save.txt
head -5 rrr.txt -->returns top 5 records
tail -3 rrr.txt -->returns last 3 records
head -4 rrr.txt|tail -1 -->returns 4th record to o/p

cut commands - column level operation


-------------
cut -d ',' -f1 rr.txt -->displays the first column from the file
cut -d ',' -f2 rr.txt -->displays the second column from the file
cut -d ',' -f1 rr.txt|sort -nr|sed -n 2p -->displays the second highest salary
cut -d ',' -f3 rr.txt|sort|uniq -->It will give the sorted and unique data
cut -d ',' -f1 rr.txt|sort -nr|uniq -->Get the unique data in descending order
cut -d ',' -f1 rr.txt|sort -->Give data in ascending order
cut -d ',' -f1 rr.txt|sort -nr -->Give data in descending order
cut -d ',' -f 1-2 rr.txt|sort -n -->Gives two columns in sorted order
cut -c 1-7 rr.txt -->cut the characters from 1-7 range.

find commands
----------------
find ./ .name rr.txt -->Find the location of the file
find ./ .perm 777 -->Get the files which have permission for read,write and
execute
find ./ -type f -name ".sh" -->Displays the files with .sh extension
find ./ -type f -name ".temp" -exec rm -rf () \; -->run,execute and exit from
there
find -mtime +7 -->Get the 7 days older files
find -mtime +7 -name '".temp' -exec rm -rf () \;

./ - {pwd}
rf - recursively & forcefully

awk commands
---------------
awk '{print$1,$2}' rr.txt -->print the first two columns from the list ->used for
'' spaced data
awk -F ',' '{print$1,$2}' rr.txt -->print the first two columns from the list -
>used for , seperated data
awk -F ',' '{print $1,$NF}' rr.txt -->displays the first and last columns into the
o/p.
awk 'NR==3,NR==6 {print NR,$0}' rr.txt -->displays from 3rd to 6th records.
awk -F ',' '{print NR "-" $2}' rr.txt -->prints with 1-ganga
awk -F ',' '{print $1 "-" $2}' rr.txt -->prints with 100-ganga
awk -F ',' '{print $1 "|" $2}' rr.txt -->prints with 100|ganga

ll
diff b/w grep(single string) and egrep(multiple strings)
cat rrr.txt|sort -n|uniq
kill -9 PID->used to kill the process
awk -F ',' '{print$1,$NF}' rrr.txt
rm -rf raja.txt rr.txt-->remove the file/multiple files
ps -elf -->List of tasks running in the background.
cp rrr.txt rr.txt -->copy from rrr to rr txt file.
diff rrr.txt rr.txt -->compares both the files
sdiff rrr.txt rr.txt -->compares the both the files and display side by side
mv rrr.txt rrr1.txt -->Renaming the file name from rrr to rrr1
cp rrr1.txt /home/gireeshdarshi -->copying the files to the given location.
mv rrr1.txt /home/gireeshdarshi/test -->moving permanently from current location
to the given location
cat rr.txt|tr [a-z] [A-Z] -->change from small letter to capital letter
cat rr.txt|tr ',' '|' -->To change the data from , seperated to | seperated
echo "hellow world 123"|tr -d 123 -->used to remove the values,special characters
from the string
echo "hellow world 123"|tr -d [:digit:] -->used to remove the digits from the
string
mtime - modified time
atime - accessed time
ctime - creation time
find ./ -size -1gb-->displays the files with 1gb size
df -k -->displays how much data the files used and how much is remaining
du
uniq -c rr.txt-->count of the duplicate rows

m commands
-----------
m_expand -n rr.txt - no.of partitions in mfs
m_cat
m_db_test oracle.dbc
m_dump - C:\AbInitio\emp_ip.dml c:/abinitio/ata/emp_ip1.txt -start20 -end30 (Read
the content of the multi files) m_dump - C:\AbInitio\emp_ip.dml
c:/abinitio/ata/emp_ip1.txt show partial
m_db unload C:\AbInitio\db\oracle.dbc -select "select sum(sal) from emp" (used to
unload the data from table)
m_rollback - It will rollback the records that has been loaded till the last
successful check point of the graph .-d c:/abinitio/abc.rec (delete the recovery
file)
I have done the same, here is the displayed list
m_mkfs C:\AbInitio\MFS\4WAY C:\AbInitio\MFS\p0 C:\AbInitio\MFS\p1 C:\AbInitio\MFS\
p2 C:\AbInitio\MFS\p3
m_aggregate
m_chmod - change the permission of the multi-file
m_cleanup
m_cp
m_db - This command is used for performing database operation from the command
prompt.
m_db_cleanup
m_db_env
m_db_layout
m_dbload
m_dbunload
m_df
m_du
m_env
m_eval
m_kill
m_ls - list the multifiles alone
m_mkdir
m_partition
m_sort
m_touch
m_view_errors -
m_db_gendml loc abc.dml
m_wc - This command is used to count number of records from one or more data
files/multi files.

air commands
--------------
9) Air sandbox run /usr/opt/tdbank/mp/abc.mp run graph from unix
4) Air object versions -verbose <EME Path for the object – /Projects/edf/mp/abc.mp>
— Gives the Version History of the object.
7) Air lock show -project <EME Path for the project – /Projects/edf/.. > — shows
all the files that are locked in the given project
air lock break

1) Air object ls /Projects/edf/dml. > — This is used to see the listing of objects
in a directory inside the project.

2) Air object rm /Projects/edf/mp/abc_test.mp — This is used to remove an object


from the repository. Please be careful with this.

3) Air object cat /Projects/edf/dml/abc.dml.. > — This is used to see the object
which is present in the EME.

5) Air project show <EME Path for the project – /Projects/edf/.. > — Gives the
whole info about the project. What all types of files can be checked-in etc.

6) Air project modify <EME Path for the project – /Projects/edf/.. > -extension
<something like *.dat within single quotes> <content-type> — This is to modify the
project settings. Ex: If you need to checkin *.java files into the EME, you may
need to add the extension first.

8) Air lock show -user <ganga123> — shows all the files locked by a user in various
projects.

10) Air project import <EME Path for the object – /Projects/edf/.. > --used to
chechin
11) Air project export <sandbox Path for the object – /Projects/edf/.. > --used to
checkout

air object compare version1 version2 - returns the objects differing in version.

air lock set


air lock release
air lock show -project
air lock show -user
air object ls
air object rm
air object cat
air object versions
air project export
air project import
air project show
air project modify
air sandbox status
air tag ls

private sandbox,public/comon.
dev-->sit-->prod

pset
graph level parameters
sandbox parameters
proj parameters
pdl

air tag ls -e
air tag create INT_TAG1 <.save_file
echo
env

air tag ls

i/p 10 o/p 3,4 ->rollup


i/p 3 o/p 12,15 ->normalize
i/p 5 o/p 5 ->scan,reformat

You might also like