Using Linux

Linux Frequently Asked Questions


How Do I Edit a Text File

Method 1: Edit From the Command Line

nano filename.ext

Method 2: Edit using a Graphical Text Editor


How Do I Reboot My Linux Box from the Command Line?

Issue the following command.

reboot -n

…or…

sudo reboot -n

Linux Networking


Release the Current DHCP Lease

The following command is used to release the current DHCP lease.

sudo dhclient -r

Renew the Current DHCP Lease

The following command is used to renew the DHCP lease and re-obtain an IP address.

sudo dhclient

Edit Network Controller Settings

You can use the system-config-network command to do the following:

  • Change from using DHCP to automatically assign an IP address to your linux machine to assigning a static IP to the box.
  • Change the name of your ethernet interface. I.E. - (Change eth0 to eth1 , etc.)
  • Change your subnet mask
  • Change the default gateway IP of the ethernet interface

Automating Tasks

Automating tasks is fairly straightforward in linux. Using the crontab command as outlined below. For instance, I would like to set up my machine to restart at a certain time of day, every day. Here's how I would do it:

  1. Type crontab -e then press enter.
  2. Press the Insert key on the keyboard, you should see — INSERT — appear at the bottom of the screen.
  3. Create a line in the crontab file that looks like this:
30 6 * * * /sbin/shutdown -r now
  1. Next, press the escape key to exit — INSERT — mode.
  2. Press ZZ and vi will exit and save the changes to the file. The new actions are now in the cron schedule.

This command sequence above will set the computer to restart computer every day at six thirty in the morning.

Links:
Cron Tutorial
Using the vi Editor in Linux
Linux Date Command Reference


page_revision: 11, last_edited: 1217468451|%e %b %Y, %H:%M %Z (%O ago)
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-NoDerivs 3.0 License