For all linux commands, you can press the button twice "tab" to see the possibility of commands that can be used. For example if you want to know any command that begins with the initial letter co, then simply type c and press "tab" twice, the command-command beginning with the letter co will appear.
# co2x col colrm comm compgen complete consoletype colcrt column command compile_et consolehelper continue
Help
Each command usually has a parameter that we can use, we know this can easily by typing additional (space)-help in order that we want to learn more.
# ps --help ********* simple selection ********* ********* selection by list ********* -A all processes -C by command name -N negate selection -G by real group ID (supports names) -a all w/ tty except session leaders -U by real user ID (supports names) ... dan seterusnya
Pipe(|)
Pipe (|) can be used to combine two or more commands to achieve the output that we want, different commands are adequately separated by symbol "|".
For example if we want we can split the output from the command listing (ls), which is more than one page, we can use the command more, this will stop the display perhalaman. Or we want to filter the output of ps, for example just want to show a line that has the word nginx, it can be done using grep;
# ps aux | grep nginx root 10148 0.0 0.3 42948 1012 ? Ss 21:42 0:00 nginx: master process /usr/local/sbin/nginx nobody 10149 0.0 0.8 43848 2316 ? S 21:42 0:00 nginx: worker process nobody 10150 0.0 0.8 43716 2196 ? S 21:42 0:00 nginx: worker process nobody 10151 0.0 0.9 43956 2424 ? S 21:42 0:00 nginx: worker process nobody 10152 0.0 0.5 43324 1444 ? S 21:42 0:00 nginx: worker process nobody 10153 0.0 0.8 44120 2308 ? S 21:42 0:00 nginx: worker process root 11328 0.0 0.2 5996 540 pts/0 R+ 22:41 0:00 grep nginx
df
Used to view information filesystems on each partition. But commonly used is the df-h because it looks easily understood by us, some other parameters can be used to change preferences that you want.
# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 40G 17G 21G 46% / varrun 512M 84K 512M 1% /var/run varlock 512M 0 512M 0% /var/lock udev 512M 16K 512M 1% /dev devshm 512M 0 512M 0% /dev/shm none 512M 0 512M 0% /dev/shm
ps
ps is the command used if we need to check the processes running on the server. Examples of the ps command is ps-aux basis, because all running processes will appear. If we only want to see a process (eg Apache), then use the command ps-aux | grep apache.
top
Displays system statistics and details of the process in an active server.
w
To see who is logged on the server
netstat
Displays a summary of the status of network connections and sockets that are running on the server. We can specialize to a particular port (eg port 80), then the command to use is netstat | grep: 80
yum / apt-get
yum is a package manipulation commands that are typically used by rpm-based Linux distributions like Red Hat, CentOS and Fedora, while apt-get is used by debian-based Linux distributions like Debian and Ubuntu. Manipulation of files with the package management will greatly depend on the used Linux distribution.
To install or update package, can use the command:
$ yum install "packet name" $ apt-get install "paket name"Or if we need to update packet, can use the command:
$ yum update "paket name"Atau untuk mencari paket yang tersedia sesuai dengan keyword yang kita masukkan dapat dilakukan dengan cara;
$ yum search keywordfree
Digunakan untuk melihat sisa memory dan swap yang terpakai, umumnya digunakan free -m yaitu mengecek memory dengan satuan MB. Contoh penggunaan:
# free -m total used free shared buffers cached Mem: 1024 387 636 0 154 98 -/+ buffers/cache: 135 888 Swap: 2047 0 2047
wget
Can be used to download files, grab the website, mirroring, etc.. The following examples of use
Downloading files from the server:
$ wget http://www.goldendrake.web.id/contoh.txtDownloading with meresume system files:
$ wget -c http://www.goldendrake.web.id/contoh.txtDownloading and used as background, so that we can do something else while the file downloaded:
$ wget -b http://www.goldendrake.web.id/contoh.txt
kill
As the name suggests, this command is used to kill or stop a process. Usually before using kill, then first we run the ps command to see the ID process that wants to kill.
$ ps aux | grep apache2 www-data 9576 0.0 0.2 11272 2156 ? S Sep06 0:00 /usr/sbin/apache2 -k start www-data 9577 0.0 0.1 11456 2020 ? S Sep06 0:00 /usr/sbin/apache2 -k start www-data 9578 0.0 0.3 185916 3588 ? Sl Sep06 0:00 /usr/sbin/apache2 -k start www-data 10523 0.0 0.3 185912 3596 ? Sl Sep06 0:00 /usr/sbin/apache2 -k start
Then to stop the process, we type the command kill -9 accompanied by [the means of execution] and PID id:
$ kill -9 1537
ifconfig
This command is used to view IP configuration already exists on the network interface that is on our server. The ifconfig command can also be used to determine the IP address and netmask on an interface. Examples of the use ifconfig to see certain ethernet configuration;
# ifconfig -eth0 eth0 Link encap:Ethernet HWaddr aa:00:21:fa:62:01 inet addr:117.103.xx.xxx Bcast:117.103.xx.255 Mask:255.255.255.0 inet6 addr: fe80::a800:21ff:fefa:6201/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:3052329 errors:0 dropped:0 overruns:0 frame:0 TX packets:123389 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:895150664 (853.6 MB) TX bytes:20386246 (19.4 MB)
last
This command is used to see people who logged in last.
# last test pts/0 117.103.52.34 Mon Sep 7 15:37 still logged in
locate
Used to find files based on file name or by keyword
locate "name file"
tail
Used to display the final pieces of the file.
tail /var/log/messages #melihat 10 baris terakhir dari /var/log/messages tail -f /var/log/messages # melihat line dari /var/log/messages secara terus menerus
ping
Just like windows, linux can also check the communication between computers in a network through TCP / IP.
ping ip.address/hostname
traceroute
Traceroute is used to test the link connection to a server. This command will display routing TCP / IP packets from our host to the host.
traceroute ip.address/hostname
shutdown
This command is used to shut down or reboot the system.
shutdown-r now # will restartIf we want to turn off the server, then commandnya are:
shutdown -h now
pwd
Used to see where we are in the directory.
#pwd /home/testMeans we are in the folder / home / test
0 komentar:
Posting Komentar