Tuesday, October 9

100 Basic Linux Commands -part2

36. fsck - File system consistency check and repair
#fsck /var

37. ftp -File Transfer Protocol
#ftp ftp.tugraz.at

38. grep - Search file(s) for lines that match a given
#tail -f /var/log/maillog |grep yahoo.com

39. gzip - Compress or decompress named file(s)
#gzip testfile.txt
After gzip command filename is testfile.txt.gz
How to extract gzip?
#gunzip testfile.txt.gz

40. halt -Stop the system, Halt, reboot, poweroff
#halt

41. history -Command History, List your previous commands
#history
#history |grep ftp

42. hostname -Print or set system name
#hostname <hostname>
#hostname rsc

43. id -Print user's identity
#id ronald

44. ifconfig -Configure a network
#ifconfig eth0 192.168.0.1 netmask 255.255.255.0

45. ipaddr -Lists all your inet address details
#ipaddr
1: lo: mtu 16436 qdisc noqueue
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:08:74:c5:c0:14 brd ff:ff:ff:ff:ff:ff
inet 83.129.4.30/27 brd 83.129.4.31 scope global eth0
inet 192.168.60.1/24 brd 192.168.60.255 scope global eth0:1
inet 84.229.6.107/28 brd 84.229.6.111 scope global eth0:2
inet 192.168.1.1/24 brd 192.168.1.255 scope global eth0:3
inet6 fe80::208:74ff:fec5:c014/64 scope link
valid_lft forever preferred_lft forever
3: sit0: mtu 1480 qdisc noop
link/sit 0.0.0.0 brd 0.0.0.0

46. kill -Stop a process from runnin
#kill spamd
#kill -9
#kill -9 26711

47. less -Display output one screen at a
#less
#less /etc/named.conf

48. links -lynx-like alternative character mode WWW browser
#links www.google.com

49. local - Create variables
* can only be used in a function

50. locate -Find files
#locate squid
#locate *.doc

51.logout -Exit a login shell
#logout

52. logrotate - Rotates, compresses, and mails system logs
*rotate mail system logs and dependent to /etc/logrotate.d/

53. lpr -Off line print files

54. ls -List information about file(s)
#ls -al /home
#ls -halt /var
*list /var sorted by date.

55. make -Recompile a group of programs
*is used to maintain programs.

56. man -Help manual
#man ls
#man tail

57. mkdir -Create new folder(s)
#mkdir testfolder

58. mktemp -Make temporary filename (unique)
#mknod testfile

59. more -Display output one screen at a time
#more testfile

60. mount -Mount a file system
#mount /dev/sda1 /mnt/usbflash
#mount /home

61. mv -Move or rename files or directories
#mv testfile testfile1
#mv rondir /var/

62. nslookup -Query Internet name servers interactively
[root@rsc var]# nslookup
> set type=mx
> yahoo.com
Server: 83.229.64.10
Address: 83.229.64.10#53

Non-authoritative answer:
yahoo.com mail exchanger = 1 e.mx.mail.yahoo.com.
yahoo.com mail exchanger = 1 f.mx.mail.yahoo.com.
yahoo.com mail exchanger = 1 g.mx.mail.yahoo.com.
yahoo.com mail exchanger = 1 a.mx.mail.yahoo.com.
yahoo.com mail exchanger = 1 b.mx.mail.yahoo.com.
yahoo.com mail exchanger = 1 c.mx.mail.yahoo.com.
yahoo.com mail exchanger = 1 d.mx.mail.yahoo.com.

Authoritative answers can be found from:
yahoo.com nameserver = ns3.yahoo.com.
yahoo.com nameserver = ns4.yahoo.com.
yahoo.com nameserver = ns5.yahoo.com.
yahoo.com nameserver = ns6.yahoo.com.
yahoo.com nameserver = ns8.yahoo.com.
yahoo.com nameserver = ns1.yahoo.com.
yahoo.com nameserver = ns2.yahoo.com.
ns1.yahoo.com internet address = 66.218.71.63
ns2.yahoo.com internet address = 68.142.255.16
ns3.yahoo.com internet address = 217.12.4.104
ns4.yahoo.com internet address = 68.142.196.63
ns5.yahoo.com internet address = 216.109.116.17
ns6.yahoo.com internet address = 202.43.223.170
ns8.yahoo.com internet address = 202.165.104.22
>exit

63. passwd -Modify a user password
[root@rsc var]# passwd rcabusas
Changing password for user rcabusas.
New UNIX password:
BAD PASSWORD: it is WAY too short
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

64. paste -Merge lines of files
#cat num1
1
2
#cat let2
a
b
c
#paste num1 let2
1 a
2 b
c

65. chage -Change user password expiry information
#chage -E YYYY-MM-DD
#chage -E 2008-01-01 rsc

66. ping -Test a network connection
#ping yahoo.com
#ping 198.6.1.2

67. ps -Process status
PID TTY STAT TIME COMMAND
1 ? Ss 0:02 init [5]
2 ? S 0:00 [migration/0]
3 ? SN 0:00 [ksoftirqd/0]
4 ? S 0:00 [watchdog/0]
5 ? S<>
6 ? S<>
7 ? S<>
10 ? S<>
11 ? S<>
1455 ? S<>
1908 ? Ss 0:09 syslogd -m 0
1911 ? Ss 0:00 klogd -x
1942 ? Ssl 0:00 /usr/sbin/named -u named -c /etc/named.caching-nameserver.conf -t /var/named/chroot

68.pwd -Print Working Directory
[root@rsc html]# pwd
/var/www/html

69.quota -Display disk usage and limits
70. quotacheck -Scan a file system for disk usage
*quota must be turn on to used its function

72. rm -Remove files
#rm -rf /home
#rm testfile

73. scp -Secure copy (remote file copy)
#scp projects.doc ron@192.168.1.1:
*projects.doc will becopied to /home/ron folder of 192.168.1.1 host.

74. shutdown -Shutdown or restart linux
#shutdown -h now (halt)
#shutdown -r now (reboot)

75. sort -sort lines text files
#sort testfile
*testfile alphabetically sorted

76. lynx -Command line browser
#lynx www.yahoo.com

77. touch -Create file timestamps
#touch testfilename
*same function as mktemp

78. usermod - modify a user account
#usermod -d /home/new/ron ron

79. useradd - create a new user or update default new user information
#useradd -d /home/user1 -C "User 1 Directory" user1

80. userdel - delete a user account and related files
#userdel -r user1
*it will delete all info associated with user1


No comments: