NAME
fallocate - preallocate space to a file
SYNOPSIS
fallocate [-n] [-o offset] -l length filename
DESCRIPTION
fallocate is used to preallocate blocks to a file. For
filesystems which support the fallocate system call, this is
done quickly by allocating blocks and marking them as unini‐
tialized, requiring no IO to the data blocks. This is much
faster than creating a file by filling it with zeros.
As of the Linux Kernel v2.6.31, the fallocate system call is
supported by the btrfs, ext4, ocfs2, and xfs filesystems.
The exit code returned by fallocate is 0 on success and 1 on
failure.
#command
fallocate - preallocate space to a file
SYNOPSIS
fallocate [-n] [-o offset] -l length filename
DESCRIPTION
fallocate is used to preallocate blocks to a file. For
filesystems which support the fallocate system call, this is
done quickly by allocating blocks and marking them as unini‐
tialized, requiring no IO to the data blocks. This is much
faster than creating a file by filling it with zeros.
As of the Linux Kernel v2.6.31, the fallocate system call is
supported by the btrfs, ext4, ocfs2, and xfs filesystems.
The exit code returned by fallocate is 0 on success and 1 on
failure.
#command
Academy and Foundation unixmens | Your skills, Your future
NAME fallocate - preallocate space to a file SYNOPSIS fallocate [-n] [-o offset] -l length filename DESCRIPTION fallocate is used to preallocate blocks to a file. For filesystems which support the fallocate system call…
از أپشن های دستور fallocate میتوان به موارد زیر اشاره نمود :
OPTIONS
The length and offset arguments may be followed by binary
(2^N) suffixes KiB, MiB, GiB, TiB, PiB and EiB (the "iB" is
optional, e.g. "K" has the same meaning as "KiB") or decimal
(10^N) suffixes KB, MB, GB, PB and EB.
-h, —help
Print help and exit.
-n, —keep-size
Do not modify the apparent length of the file. This may
effectively allocate blocks past EOF, which can be
removed with a truncate.
-o, —offset offset
Specifies the beginning offset of the allocation, in
bytes.
-l, —length length
Specifies the length of the allocation, in bytes.
#command @unixmens
OPTIONS
The length and offset arguments may be followed by binary
(2^N) suffixes KiB, MiB, GiB, TiB, PiB and EiB (the "iB" is
optional, e.g. "K" has the same meaning as "KiB") or decimal
(10^N) suffixes KB, MB, GB, PB and EB.
-h, —help
Print help and exit.
-n, —keep-size
Do not modify the apparent length of the file. This may
effectively allocate blocks past EOF, which can be
removed with a truncate.
-o, —offset offset
Specifies the beginning offset of the allocation, in
bytes.
-l, —length length
Specifies the length of the allocation, in bytes.
#command @unixmens
از دستور wall برای ارسال یک پیام به کلیه کاربران که در سیستم وارد شده اند استفاده می شود. این پیام بر روی ترمینال نمایش داده خواهد شد. متن این پیام نیز می تواند از یک فایل خوانده شود
# wall [-n] [-t timeout] [file]
بعنوان مثال با اجرای دستور زیر، محتویات فایل text بر روی ترمینال کلیه کاربرانی که بر روی سیستم شما لاگین کرده اند نمایش داده خواهد شد.
# wall /home/tst
OPTIONS
-n, —nobanner
Suppress the banner.
-t, —timeout timeout
Abandon the write attempt to the terminals after timeout seconds. This timeout must be a positive integer.
The default value is 300 seconds, which is a legacy from the time when people ran terminals over modem
lines.
-g, —group group
Limit printing message to members of group defined as a group argument. The argument can be group name or
GID.
-V, —version
Display version information and exit.
-h, —help
Display help text and exit.
NOTES
Some sessions, such as wdm, that have in the beginning of utmp(5) ut_type data a ':' character will not get the
message from wall. This is done to avoid write errors.
#wall #command #sysadmin #devops @unixmens
# wall [-n] [-t timeout] [file]
بعنوان مثال با اجرای دستور زیر، محتویات فایل text بر روی ترمینال کلیه کاربرانی که بر روی سیستم شما لاگین کرده اند نمایش داده خواهد شد.
# wall /home/tst
OPTIONS
-n, —nobanner
Suppress the banner.
-t, —timeout timeout
Abandon the write attempt to the terminals after timeout seconds. This timeout must be a positive integer.
The default value is 300 seconds, which is a legacy from the time when people ran terminals over modem
lines.
-g, —group group
Limit printing message to members of group defined as a group argument. The argument can be group name or
GID.
-V, —version
Display version information and exit.
-h, —help
Display help text and exit.
NOTES
Some sessions, such as wdm, that have in the beginning of utmp(5) ut_type data a ':' character will not get the
message from wall. This is done to avoid write errors.
#wall #command #sysadmin #devops @unixmens
دستور set :
دستور set یک تابع پیشفرض در شل های csh ksh و bash میباشد که برای تعریف و تعیین مقادیر محیطی سیستم بکار میرود. در این نکته برخی از سوئیچ های دستور set را با هم میبینیم. ما سوئیج های این دستور را در محیط bash انجام دهیم.
سوئیچ b- :
این سوئیچ به این منظور استفاده میشود که وقتی یک job به انجام رسید به ما پیغام داده شود. برای مثال اگر ما دستور & sleep 15 را اجرا کنیم و به دنبال آن دستور set -b را نیز اجرا کنیم هنگامی که 15 ثانیه گذشت پیغامی مثل زیر به ما نمایش داده میشود :
[1]+ Done sleep 15
که منتظر است تا ما کلید اینتر را بزنیم تا یک sub shell برایمان اجرا شود.
نکته : حرف b در این دستور معادل background است.
سوئیچ e- :
این دستور را هنگامی که اجرا کنیم پس از آن (تا وقتی که یک bash جدید باز نکردیم) هر موقع که یک دستور را به اشتباه وارد کردیم و اجرا نشد shell بسته میشود. در این دستور حرف e را میتوانید به کلمه exit نیز تعبیر کنید.
سوئیچ n- :
کاربرد این سوئیچ این است که کاربردی ندارد !! دستور set -n وقتی که اجرا شد دستورات ما را میخواند ولی اجرا نمیکند. این دستور ممکن است برای چک کردن یک ارور در سینتکس اسکریپت نوشته شده مورد استفاده قرار بگیرد. n را در این دستور میتوانید معادل nothing نیز تعبیر کنید.
سوئیچ t- :
هنگامی که دستور set -t را در شل اجرا کنیم بلافاصله شل را میبندد. حرف t در این دستور به معنای terminate نیز میباشد که در واقع session ما را terminate یا خاتمه میدهد.
سوئیچ C- :
دستور set -C از overwrite شدن یک فایل رو دیگری با استفاده از دستورات redirect کردن جلوگیری میکند. حرف C را در این دستور میتوانید معادل کلمه Cancel و یا Contain نیز تعبیر کنید.
#linux #command #set #bash @unixmens
دستور set یک تابع پیشفرض در شل های csh ksh و bash میباشد که برای تعریف و تعیین مقادیر محیطی سیستم بکار میرود. در این نکته برخی از سوئیچ های دستور set را با هم میبینیم. ما سوئیج های این دستور را در محیط bash انجام دهیم.
سوئیچ b- :
این سوئیچ به این منظور استفاده میشود که وقتی یک job به انجام رسید به ما پیغام داده شود. برای مثال اگر ما دستور & sleep 15 را اجرا کنیم و به دنبال آن دستور set -b را نیز اجرا کنیم هنگامی که 15 ثانیه گذشت پیغامی مثل زیر به ما نمایش داده میشود :
[1]+ Done sleep 15
که منتظر است تا ما کلید اینتر را بزنیم تا یک sub shell برایمان اجرا شود.
نکته : حرف b در این دستور معادل background است.
سوئیچ e- :
این دستور را هنگامی که اجرا کنیم پس از آن (تا وقتی که یک bash جدید باز نکردیم) هر موقع که یک دستور را به اشتباه وارد کردیم و اجرا نشد shell بسته میشود. در این دستور حرف e را میتوانید به کلمه exit نیز تعبیر کنید.
سوئیچ n- :
کاربرد این سوئیچ این است که کاربردی ندارد !! دستور set -n وقتی که اجرا شد دستورات ما را میخواند ولی اجرا نمیکند. این دستور ممکن است برای چک کردن یک ارور در سینتکس اسکریپت نوشته شده مورد استفاده قرار بگیرد. n را در این دستور میتوانید معادل nothing نیز تعبیر کنید.
سوئیچ t- :
هنگامی که دستور set -t را در شل اجرا کنیم بلافاصله شل را میبندد. حرف t در این دستور به معنای terminate نیز میباشد که در واقع session ما را terminate یا خاتمه میدهد.
سوئیچ C- :
دستور set -C از overwrite شدن یک فایل رو دیگری با استفاده از دستورات redirect کردن جلوگیری میکند. حرف C را در این دستور میتوانید معادل کلمه Cancel و یا Contain نیز تعبیر کنید.
#linux #command #set #bash @unixmens
ابزار curl ابزای قدرتمند جهت تست و فراتر از آن
ابزار curl یک ابزار قدرتمند برای کسب اطلاعات و ... می باشد و نمونه ای از ابزار قدر تمندی هست در زیر به چند مثال کاربردی خواهیم پرداخت :
در شرح curl می خوانیم :
curl is a tool to transfer data from or to a server, using one of the supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3,
POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET and TFTP). The command is designed to work without user interaction.
curl offers a busload of useful tricks like proxy support, user authentication, FTP upload, HTTP post, SSL connections, cookies, file transfer resume, Metalink, and
more. As you will see below, the number of features will make your head spin!
curl is powered by libcurl for all transfer-related features. See libcurl(3) for details.
curl {{http://example.com}} -o {{filename}}
//دانلود محتوای وب سایت
curl -I http://example.com // کسب اطلاعات هدر وب سایت
برای نمونه :
HTTP/1.1 200 OK
Date: Sun, 16 Oct 2016 23:37:15 GMT
Server: Apache/2.4.23 (Unix)
X-Powered-By: PHP/5.6.24
Connection: close
Content-Type: text/html; charset=UTF-8
curl -v google.com
//اطلاعات post و get و دیتا وب سایت
* Rebuilt URL to: google.com/
* Trying 216.58.210.14...
* TCP_NODELAY set
* Connected to google.com (216.58.210.14) port 80 (#0)
> GET / HTTP/1.1
> Host: google.com
> User-Agent: curl/7.53.1
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Location: http://www.google.com/
< Content-Type: text/html; charset=UTF-8
< Date: Sat, 19 May 2018 09:11:28 GMT
< Expires: Mon, 18 Jun 2018 09:11:28 GMT
< Cache-Control: public, max-age=2592000
< Server: gws
< Content-Length: 219
< X-XSS-Protection: 1; mode=block
< X-Frame-Options: SAMEORIGIN
<
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>
* Connection #0 to host google.com left intact
curl -T file.zip ftp://ftp.domain.com/ --user username:password
// آپلود فایل به اف تی پی سرور
curl -O -L -C - {{http://example.com/filename}}
// following [L]ocation redirects, and automatically [C]ontinuing (resuming) a previous file transfer
curl -d {{'name=bob'}} {{http://example.com/form}} // Send form-encoded data (POST request of type application/x-www-form-urlencoded):
curl -H {{'X-My-Header: 123'}} -X {{PUT}} {{http://example.com}} // Send a request with an extra header, using a custom HTTP method:
curl -d {{'{"name":"bob"}'}} -H {{'Content-Type: application/json'}} {{http://example.com/users/1234}} // Send data in JSON format, specifying the appropriate content-type header:
curl -u myusername:mypassword {{http://example.com}}
curl --cert {{client.pem}} --key {{key.pem}} --insecure {{https://example.com}} // Pass client certificate and key for a resource, skipping certificate validation:
#curl #linux #command #bash @unixmens
ابزار curl یک ابزار قدرتمند برای کسب اطلاعات و ... می باشد و نمونه ای از ابزار قدر تمندی هست در زیر به چند مثال کاربردی خواهیم پرداخت :
در شرح curl می خوانیم :
curl is a tool to transfer data from or to a server, using one of the supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3,
POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET and TFTP). The command is designed to work without user interaction.
curl offers a busload of useful tricks like proxy support, user authentication, FTP upload, HTTP post, SSL connections, cookies, file transfer resume, Metalink, and
more. As you will see below, the number of features will make your head spin!
curl is powered by libcurl for all transfer-related features. See libcurl(3) for details.
curl {{http://example.com}} -o {{filename}}
//دانلود محتوای وب سایت
curl -I http://example.com // کسب اطلاعات هدر وب سایت
برای نمونه :
HTTP/1.1 200 OK
Date: Sun, 16 Oct 2016 23:37:15 GMT
Server: Apache/2.4.23 (Unix)
X-Powered-By: PHP/5.6.24
Connection: close
Content-Type: text/html; charset=UTF-8
curl -v google.com
//اطلاعات post و get و دیتا وب سایت
* Rebuilt URL to: google.com/
* Trying 216.58.210.14...
* TCP_NODELAY set
* Connected to google.com (216.58.210.14) port 80 (#0)
> GET / HTTP/1.1
> Host: google.com
> User-Agent: curl/7.53.1
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Location: http://www.google.com/
< Content-Type: text/html; charset=UTF-8
< Date: Sat, 19 May 2018 09:11:28 GMT
< Expires: Mon, 18 Jun 2018 09:11:28 GMT
< Cache-Control: public, max-age=2592000
< Server: gws
< Content-Length: 219
< X-XSS-Protection: 1; mode=block
< X-Frame-Options: SAMEORIGIN
<
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>
* Connection #0 to host google.com left intact
curl -T file.zip ftp://ftp.domain.com/ --user username:password
// آپلود فایل به اف تی پی سرور
curl -O -L -C - {{http://example.com/filename}}
// following [L]ocation redirects, and automatically [C]ontinuing (resuming) a previous file transfer
curl -d {{'name=bob'}} {{http://example.com/form}} // Send form-encoded data (POST request of type application/x-www-form-urlencoded):
curl -H {{'X-My-Header: 123'}} -X {{PUT}} {{http://example.com}} // Send a request with an extra header, using a custom HTTP method:
curl -d {{'{"name":"bob"}'}} -H {{'Content-Type: application/json'}} {{http://example.com/users/1234}} // Send data in JSON format, specifying the appropriate content-type header:
curl -u myusername:mypassword {{http://example.com}}
curl --cert {{client.pem}} --key {{key.pem}} --insecure {{https://example.com}} // Pass client certificate and key for a resource, skipping certificate validation:
#curl #linux #command #bash @unixmens
کتاب انگلیسی A practical Guide to Linux Commands - https://www.dropbox.com/s/r0gqw8g8g7swxlr/A_practical_Guide_to_Linux_Commands.pdf?dl=0 #book #linux #command @unixmens