Grep’i renkli yapmak için
export GREP_OPTIONS='--color=auto'
Bu satır bash başlangıç ayar dosyasına da konulabilir.
Mayıs 22, 2014 § Yorum yok § Kalıcı bağlantı
Grep’i renkli yapmak için
export GREP_OPTIONS='--color=auto'
Bu satır bash başlangıç ayar dosyasına da konulabilir.
Mayıs 12, 2014 § Yorum yok § Kalıcı bağlantı
watch -n 1 'echo "obase=2;`date +%s`" | bc'
Mayıs 12, 2014 § Yorum yok § Kalıcı bağlantı
Aynı sunucuya erişimi olan 2 kişi için birinin yaptıklarını diğeri görmek istiyor diyelim.
Bunun için 2 güzel çözüm buldum (Krediler:http://www.commandlinefu.com adresine)
Usta: script -qf | tee >(nc -kl 5000) Öğrenci: nc localhost 500
veya
Usta: bash -i 2>&1 | tee /dev/stderr | nc -l 5000 Öğrenci: nc localhost 500
Mayıs 12, 2014 § Yorum yok § Kalıcı bağlantı
sed kullanalım.
2,3,4,5. satırları görmek için
sed -n '2,5p' install.log
son satır için $ kullanılabilir.
Son satırı görmek için
sed -n '$p' install.log
Detaylı bilgi http://www.grymoire.com/Unix/Sed.html adresinde bulunabilir.
Mayıs 12, 2014 § Yorum yok § Kalıcı bağlantı
find -not -empty -type f -printf "%s\n" | sort -rn | uniq -d | xargs -I{} -n1 find -type f -size {}c -print0 | xargs -0 md5sum | sort | uniq -w32 --all-repeated=separate
Mayıs 12, 2014 § Yorum yok § Kalıcı bağlantı
Bir dizinin içeriğini web üzerinden paylaşmak istiyoruz.
Paylaştığımız dizine http://$HOSTNAME:8000/ adresinden ulaşılabilcektir.
Bu iş için python kullanmak ideal
Python 2.x için
python -m SimpleHTTPServer
Python 3.x için
python -m http.server
Mayıs 8, 2014 § Yorum yok § Kalıcı bağlantı
İki txt dosyamız olduğunu düşünelim.
Bunlardaki her satırın tekilligini sağlamak için:
sort 1.txt| uniq -u >1.tekil.txt
yapılabilir.
Her satırı tekil olan 1.txt ve 2.txt dosyaları için
Küme birleşimi:
cat 1.txt 2.txt | sort -u
Küme farkı
cat 1.txt 2.txt 2.txt | sort -u
Küme kesişimi
cat 1.txt 2.txt | uniq -d
Mart 27, 2014 § Yorum yok § Kalıcı bağlantı
Herhangi bir değişiklik yapmadan önce dosyaların yedeğini almak için bu yöntem kullanılabilinir.
Önce küme işaretinin nasıl çalıştığını bir anlayalım.
Örneğin
[root@localhost ~]# echo {a,b,c}{a,b,c}{a,b,c} aaa aab aac aba abb abc aca acb acc baa bab bac bba bbb bbc bca bcb bcc caa cab cac cba cbb cbc cca ccb ccc [root@localhost ~]# echo {a,b,c}{a,b} aa ab ba bb ca cb [root@localhost ~]# echo {a,b,c}x ax bx cx [root@localhost ~]# echo {a,b,c}xy axy bxy cxy [root@localhost ~]# echo {a,b,c}x{1,2} ax1 ax2 bx1 bx2 cx1 cx2
Görüldüğü üzere küme ile kartezyen çarpım yapılmaktadır.
Küme içinde boşluk karakteri de kullanılabilinir.
[root@localhost ~]# echo {a,b,c}{,1,2} a a1 a2 b b1 b2 c c1 c2
Değiştirmeden önce dosyanın yedeğini almak için
root@localhost ~]# cp filename{,.bak} veya degişim zamanını da backupa katmak için root@localhost ~]# cp set.txt{,".$(date "+%Y%m%d%H%M%S")"} [root@localhost ~]# ls set.txt* set.txt set.txt.20140327134115
kullanılabilir.
Şubat 10, 2014 § Yorum yok § Kalıcı bağlantı
1- İmage, pdf veya videoda üst veri öğrenmek için exiftool kullanılabilir.
Önce kuralım:
[root@xxxx ~]# sudo yum install perl-Image-ExifTool Loaded plugins: refresh-packagekit, security Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package perl-Image-ExifTool.noarch 0:8.50-1.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: perl-Image-ExifTool noarch 8.50-1.el6 epel 2.2 M Transaction Summary ================================================================================ Install 1 Package(s) Total download size: 2.2 M Installed size: 9.2 M Is this ok [y/N]: y Downloading Packages: perl-Image-ExifTool-8.50-1.el6.noarch.rpm | 2.2 MB 00:04 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : perl-Image-ExifTool-8.50-1.el6.noarch 1/1 Verifying : perl-Image-ExifTool-8.50-1.el6.noarch 1/1 Installed: perl-Image-ExifTool.noarch 0:8.50-1.el6 Complete!
Şimdi video üst verisine bakalım:
[root@xxxx ~]# exiftool sample_mpeg4.mp4 ExifTool Version Number : 8.50 File Name : sample_mpeg4.mp4 Directory : . File Size : 240 kB File Modification Date/Time : 2005:11:03 10:25:32-05:00 File Permissions : rw-r--r-- File Type : MP4 MIME Type : video/mp4 Major Brand : MP4 v2 [ISO 14496-14] Minor Version : 0.0.1 Compatible Brands : mp42, mp41 Movie Header Version : 0 Create Date : 2005:10:28 17:46:46 Modify Date : 2005:10:28 17:46:46 Time Scale : 600 Duration : 4.97 s Preferred Rate : 1 Preferred Volume : 100.00% Preview Time : 0 s Preview Duration : 0 s Poster Time : 0 s Selection Time : 0 s Selection Duration : 0 s Current Time : 0 s Next Track ID : 3 Track Header Version : 0 Track Create Date : 2005:10:28 17:46:46 Track Modify Date : 2005:10:28 17:46:46 Track ID : 1 Track Duration : 4.97 s Track Layer : 0 Track Volume : 100.00% Balance : 0 Audio Format : mp4a Audio Channels : 2 Audio Bits Per Sample : 16 Audio Sample Rate : 32000 Matrix Structure : 1 0 0 0 1 0 0 0 1 Image Width : 190 Image Height : 240 Media Header Version : 0 Media Create Date : 2005:10:28 17:46:46 Media Modify Date : 2005:10:28 17:46:46 Media Time Scale : 30 Media Duration : 4.97 s Media Language Code : eng Handler Type : Video Track Handler Description : Apple Video Media Handler Graphics Mode : srcCopy Op Color : 0 0 0 Compressor ID : mp4v Source Image Width : 190 Source Image Height : 240 X Resolution : 72 Y Resolution : 72 Bit Depth : 24 Video Frame Rate : 30 Movie Data Size : 242685 Avg Bitrate : 391 kbps Image Size : 190x240 Rotation : 0
2.tovid kullanabiliriz.
Önce kuralım:
$ aria2c http://tovid.googlecode.com/files/tovid-0.34.tar.gz $ cd ~/Downloads $ tar -xzvf tovid-0.34.tar.gz $ cd tovid-0.34 $ ./setup.py build $ su -c './setup.py uninstall'
Şimdi videonun özelliklerine bakalım:
[root@xxx ~]# tovid sample_mpeg4.mp4 Usage: tovid [command] [arguments ...] Where 'command' is one of the following: Command Description Formerly ----------------------------------------------------------------- id Identify one or more video files idvid dvd Author and/or burn a DVD makedvd menu Create an MPEG menu makemenu vcd Author and/or burn a VCD makevcd xml Create (S)VCD or DVD .xml file makexml postproc Post-process an MPEG video file postproc disc Create a DVD with menus todisc gui Start the tovid GUI todiscgui mpg Encode videos to MPEG format tovid titlesets Start the titleset wizard (new) chapters Set video chapter points with mplayer (new) The following general options are also available: --prefix | -prefix Return the tovid install prefix --version | -version Return the tovid version --info | -info Return prefix, version and python module search path These options are to be used on their own, as in: tovid --prefix Run 'tovid <command>' with no further arguments to get help on a command, and what arguments it expects. Unknown command: 'sample_mpeg4.mp4' [root@xxx ~]# tovid id sample_mpeg4.mp4 Read options from /root/.tovid/tovid.ini: ========================================================= mplex MISSING! ========================================================= mpeg2enc MISSING! ========================================================= yuvfps MISSING! ========================================================= yuvdenoise MISSING! ========================================================= ppmtoy4m MISSING! ========================================================= mp2enc MISSING! ========================================================= jpeg2yuv MISSING! You are missing CORE tovid dependencies! Please install the above MISSING dependencies and try again. See tovid.wikia.com/wiki/Tovid_dependencies for help. =========================================================
Kayıp paketler olduğu aşikar. Bu sorunu aşabilmek için mjpegtools paketini kuralım:
[root@xxx ~]# yum install mjpegtools Loaded plugins: refresh-packagekit, security Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package mjpegtools.x86_64 1:2.0.0-22.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: mjpegtools x86_64 1:2.0.0-22.el6 atrpms 734 k Transaction Summary ================================================================================ Install 1 Package(s) Total download size: 734 k Installed size: 2.2 M Is this ok [y/N]: y Downloading Packages: mjpegtools-2.0.0-22.el6.x86_64.rpm | 734 kB 00:03 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : 1:mjpegtools-2.0.0-22.el6.x86_64 1/1 Verifying : 1:mjpegtools-2.0.0-22.el6.x86_64 1/1 Installed: mjpegtools.x86_64 1:2.0.0-22.el6 Complete!
Şimdi video özelliklerine bakalım:
[root@xxx ~]# tovid id /home/fatih/sample_mpeg4.mp4 Read options from /root/.tovid/tovid.ini: -------------------------------- tovid id Identify video files Version 0.34 http://tovid.wikia.com -------------------------------- Could not find file: /home/fatih/sample_mpeg4.mp4 [root@xxx ~]# tovid id /home/fatih/small.mp4 Read options from /root/.tovid/tovid.ini: -------------------------------- tovid id Identify video files Version 0.34 http://tovid.wikia.com -------------------------------- Analyzing file: '/home/fatih/small.mp4'... ========================================================= File: /home/fatih/small.mp4 Width: 560 pixels Height: 320 pixels Aspect ratio: 1.75:1 Frames: 0 Duration: 00:00:05 hours/mins/secs Framerate: 30.000 frames per second Video format: H264 Video bitrate: 465640 bits per second --------------------------- Audio track 1 (Stream Stream, AID 0): --------------------------- Codec: Bitrate: 83048000 bits per second Sampling rate: ? Hz --------------------------- Audio track 2 (Stream #0:1(eng):, AID ): --------------------------- Codec: Bitrate: 0000 bits per second Sampling rate: ? Hz --------------------------- Audio track 3 (Stream Audio:, AID ): --------------------------- Codec: Bitrate: 0000 bits per second Sampling rate: ? Hz --------------------------- Audio track 4 (Stream aac, AID ): --------------------------- Codec: Bitrate: 0000 bits per second Sampling rate: ? Hz --------------------------- Audio track 5 (Stream (mp4a, AID ): --------------------------- Codec: Bitrate: 0000 bits per second Sampling rate: ? Hz --------------------------- Audio track 6 (Stream /, AID ): --------------------------- Codec: Bitrate: 0000 bits per second Sampling rate: ? Hz --------------------------- Audio track 7 (Stream 0x6134706D),, AID ): --------------------------- Codec: Bitrate: 0000 bits per second Sampling rate: ? Hz --------------------------- Audio track 8 (Stream 48000, AID ): --------------------------- Codec: Bitrate: 0000 bits per second Sampling rate: ? Hz --------------------------- Audio track 9 (Stream Hz,, AID ): --------------------------- Codec: Bitrate: 0000 bits per second Sampling rate: ? Hz --------------------------- Audio track 10 (Stream mono,, AID ): --------------------------- Codec: Bitrate: 0000 bits per second Sampling rate: ? Hz --------------------------- Audio track 11 (Stream fltp,, AID ): --------------------------- Codec: Bitrate: 0000 bits per second Sampling rate: ? Hz --------------------------- Audio track 12 (Stream 83, AID ): --------------------------- Codec: Bitrate: 0000 bits per second Sampling rate: ? Hz --------------------------- Audio track 13 (Stream kb/s, AID ): --------------------------- Codec: Bitrate: 0000 bits per second Sampling rate: ? Hz ========================================================= Audio is compliant with the following formats: Not compliant with (S)VCD or DVD Video is compliant with the following formats: Not compliant with (S)VCD or DVD This video does not seem to be compliant with (S)VCD or DVD standards. If you burn it to a video disc, it may not work. =========================================================
Not:exiftool hata yapabilir. Zira exif bilgilerini okuyor. Fakat tovid dosyanın içine bakıyor. Hata yapma ihtimali azdır.
3. mplayer kullanmak
[fatih@xxx ~]$ mplayer -vo null -ao null -identify -frames 0 H264_test1_Talkinghead_mp4_480x360.mp4 MPlayer SVN-r36251-snapshot-4.4.6 (C) 2000-2013 MPlayer Team Can't open joystick device /dev/input/js0: No such file or directory Can't init input joystick mplayer: could not connect to socket mplayer: No such file or directory Failed to open LIRC support. You will not be able to use your remote control. Playing H264_test1_Talkinghead_mp4_480x360.mp4. libavformat version 55.4.101 (internal) libavformat file format detected. ID_AUDIO_ID=0 ID_AID_0_LANG=eng [lavf] stream 0: audio (aac), -aid 0, -alang eng ID_VIDEO_ID=0 [lavf] stream 1: video (h264), -vid 0 VIDEO: [H264] 480x360 24bpp 24.000 fps 206.7 kbps (25.2 kbyte/s) Clip info: major_brand: mp42 ID_CLIP_INFO_NAME0=major_brand ID_CLIP_INFO_VALUE0=mp42 minor_version: 1 ID_CLIP_INFO_NAME1=minor_version ID_CLIP_INFO_VALUE1=1 compatible_brands: mp42avc1 ID_CLIP_INFO_NAME2=compatible_brands ID_CLIP_INFO_VALUE2=mp42avc1 creation_time: 2009-02-26 21:49:46 ID_CLIP_INFO_NAME3=creation_time ID_CLIP_INFO_VALUE3=2009-02-26 21:49:46 ID_CLIP_INFO_N=4 Load subtitles in ./ ID_FILENAME=H264_test1_Talkinghead_mp4_480x360.mp4 ID_DEMUXER=lavfpref ID_VIDEO_FORMAT=H264 ID_VIDEO_BITRATE=206704 ID_VIDEO_WIDTH=480 ID_VIDEO_HEIGHT=360 ID_VIDEO_FPS=24.000 ID_VIDEO_ASPECT=0.0000 ID_AUDIO_FORMAT=MP4A ID_AUDIO_BITRATE=85056 ID_AUDIO_RATE=44100 ID_AUDIO_NCH=2 ID_START_TIME=0.00 ID_LENGTH=14.97 ID_SEEKABLE=1 ID_CHAPTERS=0 ========================================================================== Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family libavcodec version 55.7.100 (internal) Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264) ========================================================================== ID_VIDEO_CODEC=ffh264 ========================================================================== Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders AUDIO: 44100 Hz, 2 ch, floatle, 85.1 kbit/3.01% (ratio: 10632->352800) ID_AUDIO_BITRATE=85056 ID_AUDIO_RATE=44100 ID_AUDIO_NCH=2 Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio)) ========================================================================== AO: [null] 44100Hz 2ch floatle (4 bytes per sample) ID_AUDIO_CODEC=ffaac Starting playback... Exiting... (End of file) ID_EXIT=EOF
4. ffmpeg kullanmak
[fatih@xxx ~]$ ffmpeg -i H264_test1_Talkinghead_mp4_480x360.mp4 ffmpeg version 1.2.1 Copyright (c) 2000-2013 the FFmpeg developers built on May 10 2013 15:14:14 with gcc 4.4.6 (GCC) 20120305 (Red Hat 4.4.6-4) configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --enable-runtime-cpudetect --enable-gpl --enable-version3 --enable-postproc --enable-avfilter --enable-pthreads --enable-x11grab --enable-vdpau --disable-avisynth --enable-frei0r --enable-libopencv --enable-libdc1394 --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC' --disable-stripping libavutil 52. 18.100 / 52. 18.100 libavcodec 54. 92.100 / 54. 92.100 libavformat 54. 63.104 / 54. 63.104 libavdevice 54. 3.103 / 54. 3.103 libavfilter 3. 42.103 / 3. 42.103 libswscale 2. 2.100 / 2. 2.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 2.100 / 52. 2.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'H264_test1_Talkinghead_mp4_480x360.mp4': Metadata: major_brand : mp42 minor_version : 1 compatible_brands: mp42avc1 creation_time : 2009-02-26 21:49:46 Duration: 00:00:14.98, start: 0.000000, bitrate: 600 kb/s Stream #0:0(eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 85 kb/s Metadata: creation_time : 2009-02-26 21:49:46 handler_name : Apple Sound Media Handler Stream #0:1(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 480x360, 206 kb/s, 24 fps, 24 tbr, 600 tbn, 1200 tbc Metadata: creation_time : 2009-02-26 21:49:46 handler_name : Apple Video Media Handler Stream #0:2(eng): Data: none (rtp / 0x20707472), 212 kb/s Metadata: creation_time : 2009-02-26 21:49:46 handler_name : hint media handler Stream #0:3(eng): Data: none (rtp / 0x20707472), 88 kb/s Metadata: creation_time : 2009-02-26 21:49:46 handler_name : hint media handler At least one output file must be specified [fatih@xxx ~]$
Kişisel favorim mplayer.