The document provides examples of Linux commands for:
1. Finding files and strings within directories using commands like find, grep, and ps.
2. Managing files and directories including deleting, moving, archiving, and checking permissions and ownership.
3. Inspecting and managing storage volumes, file systems, and logical volumes.
4. Monitoring and troubleshooting systems like checking process status, boot time, logs, and network connectivity.
Download as TXT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
140 views
Unix Scripts
The document provides examples of Linux commands for:
1. Finding files and strings within directories using commands like find, grep, and ps.
2. Managing files and directories including deleting, moving, archiving, and checking permissions and ownership.
3. Inspecting and managing storage volumes, file systems, and logical volumes.
4. Monitoring and troubleshooting systems like checking process status, boot time, logs, and network connectivity.
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3
## Search a filename:
find ./ -name "libjvm.so" -print
find /usr/sap/FP3/DVEBMGS00/work/ -name "dev*" -print -type f ##Find files with 777 permission find . perm -777 print depth --------------------------------#Search for a string in all files of a directory $grep gw/monitor * RPD_DVEBMGS40_mddszepv:gw/monitor = 1 --------------------------------## Find processes with High memory utilization echo " VSZ PID RUSER COMMAND";UNIX95= ps -ef -o 'vsz pid ruser args' |sort -nr|h ead -10 --------------------------------## Delete files within a directory (/home/sidadm/) older than given (31) number of days: Current directory and sub-directory: find /home/sidadm/. -type f -mtime +31 -name $filename -print Current directory only (not sub-directory): find /home/sidadm/. \( -name . -o -prune \) -type f -mtime +31 -exec rm -f {} + --------------------------------## Display files within a directory (/home/sidadm/) older than given (31) number of days: Current directory and sub-directory: find /home/sidadm/. -type f -mtime +31 -name $filename -print Current directory only (not sub-directory): find /home/sidadm/. \( -name . -o -prune \) -type f -mtime +31 -exec ls -ld {} + --------------------------------###Volume group change #Backout fsadm -F vxfs -b 11264M /usr/sap/FP3 lvreduce -L 11264 /dev/vg00/lvol11 #Display bdf /usr/sap/FP3 lvdisplay /dev/vg00/lvol11 vgdisplay -v /dev/vg00 #Extend lvextend -L 13312 /dev/vg00/lvol11 fsadm -F vxfs -b 13312M /usr/sap/FP3 ------------------------------------### Delete all files older then 15 days with name like WF_LOG_000000* in directo ry/sapmnt/MP1/global find /sapmnt/MP1/global -type f -name 'WF_LOG_000000*' -mtime +15 | xargs rm
### For file name with whitespace
find tmp -maxdepth 1 -name *.mp3 -print0 | xargs -0 rm ### Delete all files in a directory find . -type f -print | xargs rm -------------------------------------### Move all the files in directory 1 into directory 2 ls dir1 | xargs -I {} -t mv dir1/{} dir1/{} -------------------------------------Unix sys log $ head /var/adm/syslog/syslog.log -------------------------------------#Backout fsadm -F vxfs -b 11264M /usr/sap/FP3 lvreduce -L 11264 /dev/vg00/lvol11 ------------------------------------#Display bdf /usr/sap/FP3 lvdisplay /dev/vg00/lvol11 vgdisplay -v /dev/vg00 ------------------------------------#Extend lvextend -L 13312 /dev/vg00/lvol11 fsadm -F vxfs -b 13312M /usr/sap/FP3 ------------------------------------#Check df when File systems are not properly mounted df -h | grep -A 6 lnxbwp3 showmount -e lnxbwp3 ------------------------------------#Shows the content of file2.txt not present in file1.txt grep -Fvf file1.txt file2.txt fgrep -vf file2 file1 ------------------------------------#Displays the user name id|awk -F\( '{print $2}'|awk -F\) '{print $1}' ------------------------------------#How to create SFTP shared keys Login to the server as the user and run the following commands mkdir m 700 .ssh /usr/bin/ssh-keygen
f <home-directory>/.ssh/id_rsa
t rsa N
The keys will in the file <home-directory>/.ssh/id_rsa.pub.
------------------------------------#Check on which node of a cluster the applications are up /usr/cluster/bin/clrs status /usr/cluster/bin/clrg status
/usr/cluster/bin/clrg status -g re0-wd-rg
------------------------------------#Check time of last system boot who -b ------------------------------------# FTP file between servers scp <file_name> <username>@<Target_Hostname>:<Target_Path> ------------------------------------#ACL access (Solaris) getfacl dir_name (Solaris) setfacl -m user:username:rwx dir_name (Unix) getacl dir_name (Unix) setacl -m username:rwx dir_name ------------------------------------#grep multiple strings grep 'String1|String2' ------------------------------------#Create tar file from a directory: tar -cvf <tarfilename>.tar <dir_name> #Extract contents of a tar file: tar -xvf <tarfilename>.tar #Display contents of a tar file: tar -tvf <tarfilename>.tar -------------------------------------
(Studien Und Texte Zu Antike Und Christentum, 113) Mark Edwards - Praying and Contemplating in Late Antiquity - Religious and Philosophical Interactions-Mohr Siebeck (2019)