linux etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
linux etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster

5 Ekim 2016 Çarşamba

Internal and External Commands

Internal commands are buil-in commands.
If you don't know the type of a command, you can use "type" command:


..$ type cd
cd is a shell builtin

..$ type pwd
pwd is a shell builtin

..$ type bash
bash is /bin/bash

There is a trick about "type" command:

..$ type -a pwd
pwd is a shell builtin
pwd is /bin/pwd

"-a" option shows us is the command duplicated by external command or not.
let's understand it with "time" command:

..$ time pwd
/home/user

real 0m0.000s
user 0m0.000s
sys 0m0.000s

..$/usr/bin/time pwd
/home/user
0.00user 0.00system 0:00.04elapsed 0%CPU
(0avgtext+0avgdata 2240maxresident)k
64inputs+0outputs (1major+83minor)pagefaults 0swaps

So what happened up there:
When we typed "time pwd" we used the internal(built-in) time command
Then we typed "/usr/bin/time pwd"    that was the external time command
I hope this is a helpful explanation about difference between internal and external commands.

26 Eylül 2016 Pazartesi

Appending multiple files into a single file

Let's assume you have file1.txt file2.txt file3.txt
Open the terminal and...

..$ cat file1.txt file2.txt file3.txt > file4.txt

VIM tricks:
*While you are in normal mode you can press "ZZ" to save and exit quickly
*You can go insert mode to below the current line with pressing "o" button
*If you want to delete current line quickly in normal mode, you should press "dd"

4 Eylül 2016 Pazar

for loop in linux terminal

   I have a folder which has 3 files:

..$ ls
file1 file2 file3

Let's make a for loop:

..$ for x in `ls`
> do
> echo $x
> done;

The output:

file1
file2
file3


The most important thing is the backtick.

This is a backtick:    `  
And when we use the ls in loop, we need double backtick:
 
   `ls`

If you don't know where the backtick button is on your keyboard, you can search the images in google.