Showing posts with label gnu/linux. Show all posts
Showing posts with label gnu/linux. Show all posts

Tuesday, December 30, 2014

easy learn linux command line-part 28

Hello all linux user, this is last linux command line learning and we want to learn some useful commands. today we learn about encrypt and decrypt, download website with Wget any others.

we offer read other posts, if you like to learn more:


Other useful commands

Command Description
# alias hh='history' set an alias for a command - hh = history   
# apropos ...keyword display a list of commands that pertain to keywords of a program , useful when you know what your program does, but you don't know the name of the command   
# chsh change shell command   
# chsh --list-shells nice command to know if you have to remote into another box   
# gpg -c file1 encrypt a file with GNU Privacy Guard   
# gpg file1.gpg decrypt a file with GNU Privacy Guard   
# ldd /usr/bin/ssh show shared libraries required by ssh program   
# man ping display the on-line manual pages for example on ping command - use '-k' option to find any related commands   
# mkbootdisk --device /dev/fd0 `uname -r` create a boot floppy   
# wget -r www.fire-gate.blogspot.com download an entire web site  
# wget -c www.example.com/file.iso download a file with the ability to stop the download and resume later   
# echo 'wget -c www.example.com/files.iso' | at 09:00 start a download at any given time   
# whatis ...keyword displays description of what a program does   
# who -a show who is logged on, and print: time of last system boot, dead processes, system login processes, active processes spawned by init, current runlevel, last system clock change   

Sunday, October 5, 2014

easy learn linux command line-part 26

in this season, We will learn how to work with IP Table on the linux OS command line.
you can read more information about IP table here, if you cant know anythings about it.

IPTABLES (firewall)

Command Description
# iptables -t filter -L show all chains of filtering table   
# iptables -t nat -L show all chains of nat table   
# iptables -t filter -F clear all rules from filtering table   
# iptables -t nat -F clear all rules from table nat   
# iptables -t filter -X delete any chains created by user   
# iptables -t filter -A INPUT -p tcp --dport telnet -j ACCEPT allow telnet connections to input   
# iptables -t filter -A OUTPUT -p tcp --dport http -j DROP block HTTP connections to output   
# iptables -t filter -A FORWARD -p tcp --dport pop3 -j ACCEPT allow POP3 connections to forward chain   
# iptables -t filter -A INPUT -j LOG --log-prefix Logging on input chain   
# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE configure a PAT (Port Address Traslation) on eth0 masking outbound packets   
# iptables -t nat -A PREROUTING -d 192.168.0.1 -p tcp -m tcp --dport 22 -j DNAT --to-destination 10.0.0.2:22 redirect packets addressed to a host to another host   

Friday, July 25, 2014

easy learn linux command line-part 25

What is your Choice for make Network with Windows Systems?

May be you select some Software with diffrent GUI, But we offer SAMBA for this.
you can connect your linux system to other windows systems easily even without GUI, only with some command in linux Terminal.

we offer for more information read this post.

Microsoft Windows networks (samba)

Command Description
# mount -t smbfs -o username=user,password=pass //WinClient/share /mnt/share mount a windows network share   
# nbtscan ip_addr netbios name resolution  
# nmblookup -A ip_addr netbios name resolution   
# smbclient -L ip_addr/hostname show remote shares of a windows host   
# smbget -Rr smb://ip_addr/share like wget can download files from a host windows via smb   

Friday, June 13, 2014

easy learn linux command line-part 24

Are you use software for monitor your Wifi Or Lan Networks?
maybe yes and maybe No. there are users that use one or some soft wares for monitor his networks. some of good soft wares aren't free and you have to pay for theme.
there are other problems for user ,many of this soft wares hasnt all tools for monitor and they hasnt good and simple interface.

after this explain we want to start new linux command learn about monitor, configuration network, watch network statistics and ... .

Networking (LAN / WiFi(

Command Description
# dhclient eth0 active interface 'eth0' in dhcp mode   
# ethtool eth0 show network statistics of eth0   
# host www.fire-gate.blogspot.com lookup hostname to resolve name to ip address and viceversa   
# hostname show hostname of system  
# ifconfig eth0 show configuration of an ethernet network card   
# ifconfig eth0 192.168.1.1 netmask 255.255.255.0 configure IP Address  
# ifconfig eth0 promisc configure 'eth0' in promiscuous mode to gather packets (sniffing)  
# ifdown eth0 disable an interface 'eth0'  
# ifup eth0 activate an interface 'eth0'  
# ip link show show link status of all network interfaces   
# iwconfig eth1 show wireless networks  
# iwlist scan wifi scanning to display the wireless connections available   
# mii-tool eth0 show link status of 'eth0'  
# netstat -tup show all active network connections and their PID  
# netstat -tupl show all network services listening on the system and their PID  
# netstat -rn show routing table alike "route -n"   
# nslookup www.fire-gate.blogspot.com lookup hostname to resolve name to ip address and viceversa   
# route -n show routing table   
# route add -net 0/0 gw IP_Gateway configure default gateway   
# route add -net 192.168.0.0 netmask 255.255.0.0 gw 192.168.1.1 configure static route to reach network '192.168.0.0/16'   
# route del 0/0 gw IP_gateway remove static route   
# echo "1" > /proc/sys/net/ipv4/ip_forward activate ip routing   
# tcpdump tcp port 80 show all HTTP traffic   
# whois www.fire-gate.blogspot.com lookup on Whois database   

Friday, April 18, 2014

easy learn linux command line-part 23

we want to learn, how to use terminal for rip wav files on the CD-ROM, Clean a rewriteable CD or DVD, Burn and Mount ISO images and many other things that you can do it on the Linux Terminal.

this lesson is fun and cool !!!

Have good time with listen to music that play with a command at the command line.


If you like this post, i suggest to visit here for more.

CDROM

Command Description
# cd-paranoia -B rip audio tracks from a CD to wav files   
# cd-paranoia -- rip first three audio tracks from a CD to wav files   
# cdrecord -v gracetime=2 dev=/dev/cdrom -eject blank=fast -force clean a rewritable cdrom   
# cdrecord -v dev=/dev/cdrom cd.iso burn an ISO image   
# gzip -dc cd_iso.gz | cdrecord dev=/dev/cdrom - burn a compressed ISO image   
# cdrecord --scanbus scan bus to identify the channel scsi   
# dd if=/dev/hdc | md5sum perform an md5sum on a device, like a CD   
# mkisofs /dev/cdrom > cd.iso create an iso image of cdrom on disk   
# mkisofs /dev/cdrom | gzip > cd_iso.gz create a compressed iso image of cdrom on disk   
# mkisofs -J -allow-leading-dots -R -V create an iso image of a directory   
# mount -o loop cd.iso /mnt/iso mount an ISO image   

Friday, February 28, 2014

easy learn linux command line-part 22

If you didnt know what is Back Up?!!! Please read here first.

there are many ways for create Back Up File in the operation systems. You can Use software or use default tools in your OS. its depends on you but i prefer default tools because i think my Linux OS is very Powerful and has many Options.

if you are agree with me, read this post please.

Today, We learn how to Create your Favorite (yes favorite, because you have many options) Back Up. and learn how to get back up From other formats like: TXT, Directories and etc.

after get  Back Up, you need to move it to other partitions or removable card and even or CD, DVD, online Hard Dirve, Cloud Storages.

Backup

Command Description
# find /var/log -name '*.log' | tar cv --files-from=- | bzip2 > log.tar.bz2 find all files with '.log' extention and make an bzip archive   
# find /home/user1 -name '*.txt' | xargs cp -av --target-directory=/home/backup/ --parents find and copy all files with '.txt' extention from a directory to another   
# dd bs=1M if=/dev/hda | gzip | ssh user@ip_addr 'dd of=hda.gz' make a backup of a local hard disk on remote host via ssh  
# dd if=/dev/sda of=/tmp/file1 backup content of the harddrive to a file  
# dd if=/dev/hda of=/dev/fd0 bs=512 count=1 make a copy of MBR (Master Boot Record) to floppy   
# dd if=/dev/fd0 of=/dev/hda bs=512 count=1 restore MBR from backup copy saved to floppy   
# dump -0aj -f /tmp/home0.bak /home make a full backup of directory '/home'   
# dump -1aj -f /tmp/home0.bak /home make a incremental backup of directory '/home'   
# restore -if /tmp/home0.bak restoring a backup interactively   
# rsync -rogpav --delete /home /tmp synchronization between directories   
# rsync -rogpav -e ssh --delete /home ip_address:/tmp rsync via SSH tunnel   
# rsync -az -e ssh --delete ip_addr:/home/public /home/local synchronize a local directory with a remote directory via ssh and compression   
# rsync -az -e ssh --delete /home/local ip_addr:/home/public synchronize a remote directory with a local directory via ssh and compression  
# tar -Puf backup.tar /home/user make a incremental backup of directory '/home/user'   
# ( cd /tmp/local/ && tar c . ) | ssh -C user@ip_addr 'cd /home/share/ && tar x -p' copy content of a directory on remote directory via ssh   
# ( tar c /home ) | ssh -C user@ip_addr 'cd /home/backup-home && tar x -p' copy a local directory on remote directory via ssh   
# tar cf - . | (cd /tmp/backup ; tar xf - ) local copy preserving permits and links from a directory to another   

Thursday, January 23, 2014

easy learn linux command line-part 21

Do you know anythings about SWAP file System in linux? 
in here you can find more information about swap filesystem in Linux, but you have to know that use swap file system decrease in Linux after 2010 because many machines has powerful Ram to prevent for Crashing machine.

know we want to create a swap file system in our Linux distribution and active one or two swap filesystems.

let start:

Filesystem SWAP

Command Description
# mkswap /dev/hda3 create a swap filesystem   
# swapon /dev/hda3 activating a new swap partition   
# swapon /dev/hda2 /dev/hdb3 activate two swap partitions   

Friday, January 3, 2014

Easy learn linux command line- Part 20

Do you format any file systems in linux? 
maybe yes, you format it with GUI and maybe no. today we want to learn, how to use linux Command line for format a file system on our Hard Drive or even Floppy Drive!

lets to start: 

Format a Filesystem

Command Description
# fdformat -n /dev/fd0 format a floppy disk   
# mke2fs /dev/hda1 create a filesystem type linux ext2 on hda1 partition   
# mke2fs -j /dev/hda1 create a filesystem type linux ext3 (journal) on hda1 partition   
# mkfs /dev/hda1 create a filesystem type linux on hda1 partition   
# mkfs -t vfat 32 -F /dev/hda1 create a FAT32 filesystem   
# mkswap /dev/hda3 create a swap filesystem   

Tuesday, November 26, 2013

Easy learn linux command line- Part 19

Hello, after some months we want to learn about File system Analysis, to night.
we learn how to check or repair integrity of Variable file system in gnu\linux.

Command
Description
# badblocks -v /dev/hda1
check bad blocks on disk hda1    
# dosfsck /dev/hda1
repair / check integrity of dos filesystems on disk hda1  
# e2fsck /dev/hda1
repair / check integrity of ext2 filesystem on disk hda1  
# e2fsck -j /dev/hda1
repair / check integrity of ext3 filesystem on disk hda1  
# fsck /dev/hda1
repair / check integrity of linux filesystem on disk hda1  
# fsck.ext2 /dev/hda1
repair / check integrity of ext2 filesystem on disk hda1  
# fsck.ext3 /dev/hda1
repair / check integrity of ext3 filesystem on disk hda1  
# fsck.vfat /dev/hda1
repair / check integrity of fat filesystem on disk hda1  
# fsck.msdos /dev/hda1
repair / check integrity of dos filesystem on disk hda1  

Monday, April 1, 2013

Easy learn linux command line- Part 17

what do you do if you want to convert a file format from Dos to Linux Base OS?

to night we will learn how to use command line in linux terminal to convert some file format to linux and which commands use to recognize available format for convert.




Command Description
# dos2unix filedos.txt fileunix.txt convert a text file format from MSDOS to UNIX   
# recode ..HTML < page.txt > page.html convert a text file to html   
# recode -l | more show all available formats conversion   
# unix2dos fileunix.txt filedos.txt convert a text file format from UNIX to MSDOS   

Thursday, March 28, 2013

آموزش خط فرمان-قسمت هفدهم

گاهی اوقات نیاز به اتقال فایل هایی خود از سیستم عامل ویندوز به لینوکس هستید. گاهی اوقات هم پیش آمده که بخواهید یک فرمت ویندوزی را با تبدیل در لینوکس، قابلیت استفاده داشته باشید.

چگونه می تونید فرمت فایل های قابل تغییر را پیدا نمایید و آنها را تبدیل نمایید. در این قسمت می آموزیم به سادگی هر چه تمامتر این کار را انجام دهیم . با توجه به استفاده ویندوز از هسته سیستم عامل داس در نگارش های پیشین قسمتی از آموزش مربوط به انتقال فایل از این سیستم عامل به سیستم عامل های لینوکسی است.

تبدیل فرمت فایل ها

دستور توضیح
# dos2unix filedos.txt fileunix.txt تبدیل فرمت یک فایل متنی از سیستم MSDOS به سیستم UNIX  
# recode ..HTML < page.txt > page.html تبدیل یک فایل متنی به فرمت html   
# recode -l | more نمایش همه ی فرمت های قابل تبدیل   
# unix2dos fileunix.txt filedos.txt تبدیل فرمت یک فایل متنی از سیستم UNIX به سیستم MSDOS   

Sunday, March 17, 2013

Easy learn linux command line- Part 16

hello again, you learned how to use command line for open files in terminal in the last post. now you need to edit files!

what is your recommendation comment?
if you don't have any idea, this post is especially write for you. only persons that need to edit, compare two files with together,found differences between files, merging them, found any word and replace in the files, remove empty rows, sort content and etc.

Command Description
# cat example.txt | awk 'NR%2==1' remove all even lines from example.txt   
# echo a b c | awk '{print $1}' view the first column of a line   
# echo a b c | awk '{print $1,$3}' view the first and third column of a line   
# cat -n file1 number row of a file   
# comm -1 file1 file2 compare contents of two files by deleting only unique lines from 'file1'   
# comm -2 file1 file2 compare contents of two files by deleting only unique lines from 'file2'   
# comm -3 file1 file2 compare contents of two files by deleting only the lines that appear on both files   
# diff file1 file2 find differences between two files   
# grep Aug /var/log/messages look up words "Aug" on file '/var/log/messages'   
# grep ^Aug /var/log/messages look up words that begin with "Aug" on file '/var/log/messages'   
# grep [0-9] /var/log/messages select from file '/var/log/messages' all lines that contain numbers   
# grep Aug -R /var/log/* search string "Aug" at directory '/var/log' and below   
# paste file1 file2 merging contents of two files for columns   
# paste -d '+' file1 file2 merging contents of two files for columns with '+' delimiter on the center   
# sdiff file1 file2 find differences between two files and merge interactively alike "diff"   
# sed 's/string1/string2/g' example.txt replace "string1" with "string2" in example.txt   
# sed '/^$/d' example.txt remove all blank lines from example.txt   
# sed '/ *#/d; /^$/d' example.txt remove comments and blank lines from example.txt   
# sed -e '1d' exampe.txt eliminates the first line from file example.txt   
# sed -n '/string1/p' view only lines that contain the word "string1"   
# sed -e 's/ *$//' example.txt remove empty characters at the end of each row   
# sed -e 's/string1//g' example.txt remove only the word "string1" from text and leave intact all   
# sed -n '1,5p' example.txt print from 1th to 5th row of example.txt   
# sed -n '5p;5q' example.txt print row number 5 of example.txt   
# sed -e 's/00*/0/g' example.txt replace more zeros with a single zero   
# sort file1 file2 sort contents of two files   
# sort file1 file2 | uniq sort contents of two files omitting lines repeated   
# sort file1 file2 | uniq -u sort contents of two files by viewing only unique line   
# sort file1 file2 | uniq -d sort contents of two files by viewing only duplicate line   
# echo 'word' | tr '[:lower:]' '[:upper:]' convert from lower case in upper case   

Tuesday, February 26, 2013

آموزش خط فرمان-قسمت پانزدهم

حتما این جمله را بارها شنیده اید که در لینوکس هر چیزی به صورت فایل متنی است، همین ویژگی جالب لینوکس سبب شده است که کاربران آن بتوانند به راحتی نسبت به مطالعه اطلاعات سیستمی و تغییر آنها اقدام نمایند.از فایل های کاربران گرفته تا ریز اطلاعات سخت افزارهایی همچون پردازنده، کارت گرافیکی و ... در لینوکس به صورت فایل ذخیره می شود.
ممکن گهگاهی نیازمند باشید این فایل ها را به هر دلیلی ملاحظه نموده و تغییر دهید. به همین دلیل و با توجه به اجازه های دسترسی به این فایل ها نیازمند استفاده از خط فرمان جهت بازکردن و اعمال تغییرات خواهید بود. در قسمت پانزدهم اموزش خط فرمان لینوکس می آموزیم چگونه یک فایل را بازنموده و محتویات آنرا ببینیم.



مشاهده ی محتویات فایل

دستور توضیح
# cat file1 نمایش محتویات یک فایل با شروع از سطر اول   
# head -2 file1 نمایش دو خط اول یک فایل   
# less file1 مشابه دستور more است با این تفاوت که امکان حرکت رو به عقب نیز وجود دارد   
# more file1 نمایش محتویات یک فایل به صورت درصدی و رو به جلو   
# tac file1 نمایش محتویات یک فایل با شروع از خط آخر   
# tail -2 file1 نمایش دو خط آخر یک فایل   
# tail -f /var/log/messages نمایش محتویات یک فایل به طوری که تغییرات صورت گرفته در فایل به طور لحظه ای نمایش داده می شود   

Tuesday, February 5, 2013

Easy learn linux command line- Part 14

Hello to every one. to night we want to learn about Most Popular Command for install Packages in the Debian Base OS Like Mint, Ubuntu, Debian and etc.
apt-get is very prevalent in Debian Base OS. Apt-get Tool help you for Download, install, remove, Upgrade, clean and Many others about Packages.
many user in Linux world used this command for Packages, maybe powerful reason for this behavior is exist many article, post and information about Apt-get in Linux command line.



Command Description
# apt-cache search [package] returns list of packages which corresponds string "searched-packages"   
# apt-cdrom install [package] install / upgrade a deb package from cdrom   
# apt-get install [package] install / upgrade a deb package   
# apt-get update update the package list   
# apt-get upgrade upgrade all of the installed packages   
# apt-get remove [package] remove a deb package from system   
# apt-get check verify correct resolution of dependencies   
# apt-get clean clean up cache from packages downloaded   

Friday, January 11, 2013

Easy learn linux command line- Part 12+1

Now we know how to use YUM tool or other command in Fedora and RedHat, But what can you ,If you install mint, ubuntu,Debian and Deb Base OS.
in this session we will learn some new command line for install, update, upgrade, remove and etc in Debian OS base.
Dpkg is default command in ubuntu and Debian for work with packages.

don't forget Linux system work intelligent and only download packages that dependence to original deb package.


Command Description
# dpkg -i [package.deb] install / upgrade a deb package   
# dpkg -r [package] remove a deb package from the system   
# dpkg -l show all deb packages installed on the system   
# dpkg -l | grep httpd show all deb packages with the name "httpd"   
# dpkg -s [package] obtain information on a specific package installed on system   
# dpkg -L [package] show list of files provided by a package installed on system   
# dpkg --contents [package.deb] show list of files provided by a package not yet installed   
# dpkg -S /bin/ping verify which package belongs to a given file