Miscellaneous
tar archives are a type of compressed file, similar to zip files.
1 |
tar czfv file_name.tgz directory_to_make_a_tar |
SCP (secure copy) securely copyies files between a local and a remote system
The following code copies the contents of the local downloads folder to the machine with at IP 192.168.1.10 to its /shared/programs folder:
1 |
scp -r /downloads root@192.168.1.10:/shared/programs |
Recording audio
1 |
rec example.wav --type=wav |
To view the libraries that a specific program uses
1 |
ldd 'which kmail' |
Replacing all the .html files extensions with .txt extensions
1 |
for i in $(find . -name ' *.html ' ) ; do mv $i ${i/.html/.txt} ; done |
To switch between XServers
1 |
Using CTRL+ALT+F7 and CTRL+ALT+F8 key combinations |
When there are performance issues, the following code finds and closes (kills) long running processes using kill -9 process id.
1 |
Ps aux|grep qmailr |grep date |
Fast creation of the snmpd.conf file at first use
1 |
snmpconf -g basic_setup |
Searching folders identified by their paths (could be useful on mounted CDROMs or the NFS directory)
1 |
find / \(-path /cdrom -o -path /mnt/server \) -prune -o -name searched_file.txt -print |
To delete a file using the find command and file extension
1 |
find /home -name *.avi -print -exec rm -rf {} \; |
To view only the folders or files that are linked to
1 2 |
1ls -l | grep ^d only folders ls -l | grep ^l only links |
Actively following or tailing recorded logs
1 |
tail -f /var/log/messages |
Killing all parent and child processes that were started by a logged on user
1 |
pkill -u User_name |
Activating the DMA mode of a CD-Rom (useful in situations when frames are skipped or with similar processes during film playback)
1 |
hdparm -d1 /dev/hdX |
To place the monitor in Standby mode
1 |
xset dpms force off |
To download a specific folder from the Internet
1 |
wget -r -np http://specific_folder/ |
1 |
cp /usr/share/zoneinfo/Europe/Istanbul /etc/localtime |
to: user@domain.com
Crontab
1 2 3 4 5 6 |
field # meaning allowed values 1 minute 0-59 2 hour 0-23 3 day of month 1-31 4 month 1-12 (or names, see below) 5 day of week 0-7 (0 or 7 is Sun, or use names) |
At 03:00 (morning) daily from Monday to Friday
1 |
0 3 * * Sat /home/oracle/Batches/RmanFULLStarter.sh |
Only on Mondays
1 |
* * * * 1 /usr/local/program -- options |
Crontab related examples
# Prints out the ram to /tmp/ram every hour
1 2 3 |
0 * * * * /usr/bin/free > /tmp/ram # To run a script at 2:00, 3:00, 4:00 (writing it as 2-4 indicates the intervals) Crontab |
1 |
<strong>1</strong>- 0 2-4 * * * /root/test.sh |
# Running a script at 06:30 (morning) on the 1st and 15th of every month
1 |
<strong>1</strong>- 30 6 1,15 * * /root/backup.sh |
# To run a mrtg script every 5 mins
1 |
*/5 * * * * /root/mrtg.sh |
# To run disk.sh every Saturday at 11
1 |
* 11 * * Sat /root/disk.sh |
# To run a script every 2 hours
1 |
* */2 * * * /root/test.sh |
Using RMAN for...
12 March 2019