ViniciusMuniz.com - Programação, linux e afins.
ViniciusMuniz.com - Programação, linux e afins.
  • Linux
  • PHP
  • Contact
CentOS, Debian, Linux, Subversion, Ubuntu, Uncategorized

Easy way to scheduling commands in linux

August 5, 2013by viniciusNo Comments
utilizando o comando at linux

utilizando o comando at linux

And alas! Let us understand more a Linux command, now the at . That also did not know until recently.

Imagine yourself in the following situation, you have to run a command now, so to come back from lunch (that’s damn silly example), but will only arrive at 14:30. and your boss wants the result of this command to 2 hours, or it will eat your … liver. Simple!! The command at will leave you with your … intact liver. Let’s practice, and stop bla bla.

The command behaves like a cron that will run, and then cease to exist. Much simpler than configuring a line in cron to run a command only once.

at practice

Assuming that the command that your boss wants to be shot tomorrow, and is the list of all users logged in at 14:00, by which it accesses a file on the network.

The command accepts multiple configuration variants of the date / time. For this example we use in this way

$ At 2pm tomorrow
at> who> / var / www / list_users.html

When you enter the command at it will open a “sub-terminal” at the for you to enter your command, in our case who> / var / www / list_users. html , to save at the command, use ctrl + d .

Tips command at linux

List commands (jobs) configured at the

Use command atq , it will list the work to be performed, for your user, if you are the root of all the users.

$ Atq

Delete commands (jobs) configured at the

Use command atrm , it will remove a specific job, you should specify the work to be removed. For example:

$ Atq
5 Fri May 17 13:30:00 2013 vinicius
6 Fri May 17 13:31:00 2013 vinicius

$ 5 atrm

Going deep in at

I advise to read the documentation at as there are many tips on the same

 man at 

For example:

Running a command in 3 days at 4 o’clock

at 4pm + 3 days

Running a command on a specific day (18.10.2013) at 4 o’clock in the morning

Observer this example, the date is in standard MMDDCCYY

at 4am 10,182,013
Uncategorized

18 Linux commands you should know

August 5, 2013by vinicius1 Comment
Principais comandos linux

Principais comandos linux

I started writing this post, in order, to help with the basic commands of linux, but I think the basic is a lot. So I’ll divide by categories it will first:

Manipulating files and folders

I intend to describe in this post, the commands that I believe to be the most useful in handling files for anyone who is starting on linux , with some parameters to make life easier. Anyone who thinks any more is needed, says, I add that in the post.

Listing files

using the command ls can list the files and folders ordered by modification date, by size, among others. We can also list only files, only folders or include links. Anyway, for more details see the documentation. man ls

Listing txt files, sorted by size

 * ls-lhs. Txt 

Listing png files, sorted by size in reverse order

 * ls-lhSr. Png 

Listing php files, sorted by modification date, in reverse order

 ls-ltr *. Php 

Creating Files

There are several ways to create files in linux, including:

Touch

 touch test.php 

Cat

 cat> test.php 

Using editor

You use your editor too, I like to use the nano , or peak as editor

 nano test.php 
 peak test.php 

Delete Files

Deleting files is easy, easy. Just use the command rm .

 rm test.php 

Deleting files for an extension

 rm *. php 
 rm *. txt 

Deleting files without confirming

Using the-f argument, force will force the removal of the file.

 rm-f test.php 

Creating folder

As easy as the others, just use the command mkdir .

 mkdir viniciusmuniz 
 mkdir /var/www/viniciusmuniz 

Creating folder with permission

Who ever heard of linux, ever heard the phrase “Linux has no viruses”. Well in my opnion .. a lie, but most of the reason is due to permissions management, linux will not describe it deeply, it will be another post in this series. Who uses a host with suPHP, must have seen a lot 500 internal server error . This occurs because the folder must have permission 755, and files 644 permission. To create a folder with permission, just use the option -m .

 mkdir-m 0755 viniciusmuniz 

Create a folder recursively

did not like the name of this item, if anyone has any better, please comment. If you want to create a folder inside another that does not exist yet, you can create everything straight.

 mkdir-p /home/vinicius/test/viniciusmuniz/public_html 

Removing folders

If you tried to remove a folder, you should have seen the error rm: can not remove “folder name”: is a directory . Simple to remove a folder, you have to remove it recursively. For this we will use the argument -r .

 rm-r /home/vinicius/test/viniciusmuniz/public_html 

Remove folder without confirmation

Using the same command to “force” will add the -f

 rm-rf /home/vinicius/test/ 

Moving files and folders

To move the command we use mv . In the example we will be moving the folder to public_html / home / vinicius

 mv /home/vinicius/test/viniciusmuniz/public_html /home/vinicius/ 

Renaming folders and files

The linux has no specific command to rename. Mv is used.

 mv index.php test.php 
 mv /home/vinicius/test/ /home/vinicius/test

Modify permission

This item is here because it is directly related to this manipulation, but will again be discussed in more detail in a future post. Permission to change something, would use the chmod command.

 chmod 777 /home/vinicius/test 

recursively Permission

to give permission recursively , just add the option -r

 chmod-R 777 
Page 3 of 3«123
  • English
  • Português

Subscribe!

Thank you!

Recent Posts

  • What is Iptables, what it’s for, and how to use?
  • How to send a POST request without form
  • TTY: How to reduce the number of terminals and increase performance
  • TTY: What is? What’s the use? How to use it?
  • How to iterate through multidimensional array with php

Recent Comments

  • Vinicius Muniz on How to send a POST request without form
  • jeeja.biz (@jeejabiz) on How to send a POST request without form
  • a on How to send a POST request without form
  • Comandos linux que você deveria saber on 18 Linux commands you should know
  • TTY: How to reduce the number of terminals and increase performance on TTY: What is? What’s the use? How to use it?

Tags

array at date date in linux java java in ubuntu Linux Linux linux commands linux permissions mysql mysql.sock nmap ntp performance php php programming programming start php tips php ubuntu ubuntu languages zend zend framework zf zf2

Categories

  • CentOS
  • Debian
  • Linux
  • MySQL
  • PHP
  • Programming
  • Subversion
  • Ubuntu
  • Uncategorized

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org