Tag: terminal

5 Useful Unix DD Command Examples

By Erik Schweigert

dd is a common Unix program whose primary purpose is the low-level copying and conversion of raw data. You can backup whole hard drives, create a large file filled with only zeros, create and modify image files at specific points, and even do conversions to upper case.

To display dd‘s help simply enter:dd command unix linux

$dd –help

Alright, lets get to the juicy stuff.

1. Make an ISO of a your favourite CD just for backing up purposes with dd:

dd if=/dev/cdrom of=/home/erik/myCD.iso bs=2048 conv=sync

Breaking down the commands:

  • if is “input file”, so in this case our cdrom drive at /dev/cdrom
  • of is “output file”, in this case myCD.iso
  • bs is “block size”, in this case 2048 bytes per block
  • conv is for conversion, in this case we are using “sync” which tells DD to execute synchronized input and output, this is needed for the CD-ROM as we want to read a whole block to ensure no data loss occurs.

2. Duplicate one hard disk partition to another hard disk with dd:

dd if=/dev/sda1 of=/dev/sdb1 bs=4096 conv=noerror

In this case everything is the same as example 1 but our conversion methods states that noerror should be executed, this tells DD to continue after read errors.

3. Fill a file with 1MB of random bytes with dd:

erik@debian:~$dd if=/dev/urandom bs=1024 count=1000 of=fun.bin

1000+0 records in

1000+0 records out

1024000 bytes (1.0 MB) copied, 0.198349 s, 5.2 MB/s

This time I stated that our block size is 1024 bytes, and we are going to make 1000 of them sequentially. I also used the built-in kernel device urandom which provides random bytes.

4. Skip first 128K of input file then write remaining with dd:

dd if=/home/erik/fun.bin skip=128k bs=1 of=/home/erik/fun2.bin

The skip command tells DD to move passed the (in this case) 128k of data infun.bin then write the rest to fun2.bin. This can be handy if you have a large file that needs to be written across more than one partition. For instance, if you had 3 partitions each 128k. You wouldn’t want to write the same 128k to each partition, you would want to write the first 128k to partition 1, then from 128k-256k of the file to partition 2 and so on.

5. Using dd to convert a file to uppercase:

dd if=erik.txt of=erik_up.txt conv=ucase

Finally, we use conv again to do a conversion. In this case we convert with the specifier of ucase.

What is your favourite use of dd?

Erik is an avid Linux user and has experience with a wide variety of Linux/Unix based systems. In his spare time he likes writing software (C/C++/Perl/PHP/BASH/Python) and experimenting with different Linux distributions. He is starting to build a wide variety of articles Unix driven (what a surprise) that hope to inform those just getting into Linux on his website.


Tags: , , , , , , , , , , , ,

By Clyde E. Boom

Linux Commands – The great thing about Linux commands is that they are virtually identical from one Linux distribution (version) to another. So the way the real pros do Linux administration is to work at the Linux command line and run Linux command lineLinux commands.

Learning how to run a Linux command can be very difficult for someone new to Linux, so here are some Linux tips that will help you to learn how to use Linux commands when working at the Linux command line prompt.

There are three main parts of a Linux command:

1. The Linux command name

2. Options that can be used with the Linux command

3. The “item(s)” that the Linux command is being run “on”

When you run a Linux command, spaces are used between: the Linux command name, the command options and the “item” the command is being run “on”. The “item” could be a Linux directory, file, user or some other Linux software component.

For example, you run the Linux command named ls (for list) “on” a Linux directory to see a list of files in the directory. You run the Linux command named rm (remove) “on” a Linux directory to remove the directory from the Linux file system.

To run a Linux command, you type in the name of the command, and any other parts of the command, such as options, and press the Enter key.

You can see an example of the Linux command that is used to create a new Linux user below. The useradd command is being run “on” the bthatcher user name to create this Linux user.

Linux Tips: Linux commands are run at the Linux command line prompt and this prompt is shown as ]# at the left of the command. You don’t type in the prompt, you type the Linux command at the right of the prompt.

Linux Tips: The Linux command prompt may also appear as: ]$ or as another symbol, instead of # or $.

]# useradd -c “Becky Thatcher” bthatcher

This Linux command creates a new Linux user named bthatcher with the full name of “Becky Thatcher”. The -c (for comment) option is used with this command to add the full name as a comment to the Linux user name of bthatcher.

One of the easiest and best ways to get Linux training is to see Linux commands being run in Linux video tutorials. With this method – you see, hear and do.

With a Linux video tutorial, you see and hear how to run a Linux command and see and hear a description of the output of the command. You can also pause the video so you can run the Linux command yourself!

Copyright ©  Clyde Boom

Clyde Boom, Author and Expert Trainer with 20+ Years of Training Successes. Explains intricate technical matters in an easy-to- understand, non-technical manner, with tens of thousands of software and hardware learners into masters.

You can watch Free Sample I Learn Linux Video Tutorials at http://www.iLearnLinux.com and get over the steep Linux learning curve.

Sign up for Free I Learn Linux News to receive technical tips, info on new video samples and important updates on Linux.

You need to learn Linux the easy way to get that new job, qualify for that next promotion, earn a hefty raise, get Linux certification, or keep your current job because your company is trying to save on software licensing fees (eza). Watch, do, and learn!

Tags: , , , , , , , , , , ,

Log Monitoring Tools for Unix: Linux, Ubuntu, Red Hat and Solaris Servers

By Jacob Bowman

How to Easily Monitor and Alert on Unix Log Files…STRESS FREE!

Log Monitoring Tools for Linux and Solaris: Do you wish to monitor UNIX log file on a Linux or Sun Solaris System based on a time-frame (i.e. search for the occurrence of “pattern” in the log file within the last x amount of minutes)? If so, this article will save you hours and days of laborious work.

If you work in a UNIX environment, a time will come when you will wish to have caught a problem on one or more of your servers earlier than you did. When that time comes, you’ll scroll through your system or application logs and you’ll find a number of errors in there that speaks to an oncoming/developing problem.

You’ll wonder how you can monitor these logs in the future and alert yourself in the event of a problem. You’ll search the web for solutions and you’ll discover, to your dismay, that nothing out there is simple and straightforward enough to implement in your particular UNIX environment.

Then, you’ll want to write your own script. But alas, it is at this point that your mind will go blank. Because as you start to write your own log monitoring script, you will sadly discover that it really isn’t an easy thing to do. So you’ll begin to wonder in desperation, what do I do?

Well, I’ll tell you what you ought to do: Download or Write Your own ‘Smart Log Script’ and Keep it Simple!

What do I mean by that? Well, if you want to monitor a log file for errors/strings, and you’re concerned with efficiency, whatever script you write or download MUST follow the outline below. Emphasis on MUST!

For example, say you want to monitor the last x amount of minutes or hours of data in a particular log file for certain strings and alert if the strings are found, you MUST model your log monitoring script after the following tool:

Unix Log Tool: /bin/LogRobot (logfile-absolute-path) (time-in-minutes) ‘(string1)’ ‘(string2)’ (-found) (warn) (critical)

Example: ## /bin/LogRobot /var/log/messages 60 ‘luance’ ‘Err1310′ -found 5 10

So in this example,

/bin/LogRobot is the tool name.

/var/log/messages is the log file.

60 is the amount of previous minutes you want to search the log file for.

“luance” is one of the strings that is on the line of logs that you’re interested in.

“Err1310″ is another string on the same line that you expect to find the “luance” string on. Specifying these two strings (luance and Err1310) isolates and processes the lines you want a lot quicker, particularly if you’re dealing with a huge log file.

-found specifies what type of response you’ll get. By specifying -found, you’re saying if anything is found that matches the specified strings within the 60 minute time frame, then that should be regarded as a problem and outputted out.

5 specifies Warning. By specifying 5, you’re telling the program to alert as WARNING if there are at least 5 occurrences of the search strings you specified, in the log file within the last 60 minutes.

10 specifies Critical. By specifying 10, you’re telling the program to alert as CRITICAL if there are at least 10 occurrences of the search strings you specified, in the log file within the last 60 minutes.

Summarized Explanation:

As you can see, the LogRobot tool is monitoring a log file. The arguments that are passed to this log monitoring tool instructs it to do the following:

Within the last 60 minutes, if the tool finds less than 5 occurrences of the specified search strings in the log file, it WILL NOT alert. If the script finds at least 5 to 9 occurrences of the specified strings in the log, it’ll alert with a WARNING. If the script finds at least 10 or more occurrences of the strings in the log within the last 60 minutes, it’ll alert with a CRITICAL.

How easy is that? EXTREMELY!

For more information on how this tool works and to DOWNLOAD it for your own use, visit the following page:


Tags: , , , , ,

Linux Kernel Manual Pages

By Erik Schweigert

Having the ability to lookup how a kernel function works is very handy when writing your own device driver or any kernel module. Unfortunately you cannot just apt-get install kernel-manpages. Well wouldn’t that be nice! To get your kernel manual pages for a specific kernel you can download the kernel source and execute a few choice commands. Here is a short tutorial under Debian (and would probably work for most Linux distributions).

  1. Download your kernel version, in this case I grabbed version
  2. Untar the the document by: tar -xvf linux-
  3. Now move into the new linux- directory and type make mandocs. The system might prompt you to download missing packages to build the manuals, proceed to do so.
  4. After the documents have been made type make installmandocs, this will install the manual pages into /usr/local/man/man9/. This way you can now type man copy_to_user to see how to use the specified kernel function!

So, doing a man copy_to_user you will now get the output of:


copy_to_user – Copy a block of data into user space.


unsigned long copy_to_user (void __user * to, const void * from, unsigned long n);



Destination address, in user space.


Source address, in kernel space.


Number of bytes to copy.


User context only. This function may sleep.


Copy data from kernel space to user space.

Returns number of bytes that could not be copied. On success, this will be zero.

Erik is an avid Linux user and has experience with a wide variety of Linux/Unix based systems. In his spare time he likes writing software (C/C++/Perl/PHP/BASH/Python) and experimenting with different Linux distributions. He is starting to build a wide variety of articles Unix driven (what a surprise) that hope to inform those just getting into Linux on his website.


Tags: , ,

How to Use Your Palm Pilot With Ubuntu

By Linda McDermott

Palm Pilots can work with Ubuntu. Learn which program you will need and how to use this to install software to your device.

If you are using Ubuntu, there are times where you can’t use older hardware since it was never ever made for Linux. One older popular piece of hardware is the Palm Pilot. While you might not expect something like this to work, it will with your Ubuntu installation.

There is a program that comes with the distribution called Gpilot. If you don’t have this, it can be installed from the repositories depending on if you have a Debian based distribution. Otherwise you will have to manually install the software to get it to work.

Gpilot is an open source program that was written so that devices like the Palm Pilot and Ubuntu could interact.

Under System and Preferences you can find a program called PalmOS Devices. This is what you need to do in order to set up your Palm Pilot to be recognized with your system. You will need to select the port that your hardware is plugged into. Once you have successfully done this, you can use Gpilot in order to install software to your machine.

Unfortunately there is not a graphical user interface for this program so you have to use the terminal. Open the terminal and type in “gpilot-install-file” followed by the file that you want to install and press enter. You will then have to hot sync your data with your Palm Pilot which will install the software to your device.

A second way of installing software if you do not like doing it this way, is to get an old Palm SD card assuming your computer can read this type of data. You can drag and drop the files you need to install from your computer onto the SD card. For most things, you Palm Pilot will recognize this data. It can be read off the card or copied over the hard drive on the device which generally helps the application run a bit faster.

I enjoy writing articles and reviews on many subjects, I enjoy sharing my personal experiences with family and home experiences. I also enjoy reviewing products, enjoy my latest reviews on what you need to know about choosing a kitchen towel bar and suction towel bar for your home.

Tags: , , , ,

Running Commands at Startup in Debian and Ubuntu – The Simplest Approach

By Austin White

Running custom scripts on startup is a common operation in the Linux community. In my case, when the machine hosting my website needs to be rebooted or even crashes, it is critical that the backend processes that the website depends on start correctly. For other Linux or BSD users, it can be useful to start up useful background processes, perhaps servers for accessing your machine remotely.

The Classic Method for Running Processes at Startup

The most documented way of starting processes when the machine boots is to add a control script to /etc/init.d. This script must take an argument that can be one of “stop,” “start,” and “restart.” An example of such a script would be /etc/init.d/ssh, which is used to start and stop the ssh server. When a machine shuts down, it is important for many daemons to clean up their pid files and otherwise shut down nicely. However, for user-run processes, simply being sent SIGTERM as part of normal shutdown is sufficient.

Here is an example of a script that is used only for starting a process.

$ cat /etc/init.d/boot_server

#!/bin/sh -e

case "$1" in










echo "Usage: [this] {start|stop|restart|reload|force-reload}" >&2

exit 1



exit 0

To ensure that daemons are started and stopped, particularly in the correct order, the machine runs special symlinks to these scripts. The symlinks have special names that either begin with an S or a K. For example, my machine has /etc/rc3.d/S20lighttpd and /etc/rc0.d/K20lighttpd. (The numbers in the rc directory names are known as runlevels. A discussion of runlevels is beyond the scope of this article, and if you wish to know more, there are a number of good resources on the internet.) Scripts beginning with S are used to start a process during bootup. Those beginning with K are used to kill a process during shutdown. The number in the link name is used to determine the order in which these processes are started and killed.

Thus, to run a process at startup on your Linux machine, you would need to both add a script to /etc/init.d that takes “start” as an argument, and you would want to add symlinks to your script to the /etc/rc*.d directories. Your scripts have to follow the naming convention described above, probably starting with S99 or S98 to ensure that your processes start after all the important system daemons. The K symlink is unnecessary.

Using /etc/rc.local – A Better Way to Start Processes on Debian and Ubuntu

Instead of adding a startup script and the related symlinks, a much easier approach is to add your commands to the bash script /etc/rc.local. A quick look at /etc/rc.local demonstrates that it is rather self-explanatory.

$ cat /etc/rc.local

#!/bin/sh -e


# rc.local


# This script is executed at the end of each multiuser runlevel.

# Make sure that the script will "exit 0" on success or any other

# value on error.


# In order to enable or disable this script just change the execution

# bits.


# By default this script does nothing.

exit 0

At the end of /etc/rc.local, but before the exit 0 line, I can simply add a call to my server startup script:

# Run website processes


It is a one-line change, instead of adding an overly complicated script and the related symlinks. Of course, this is not an option if you require additional commands to be run at shutdown. In addition, if you need your process to be started before some other system process, you must resort to the classic startup script as discussed above. /etc/rc.local almost the last script to be run as part of the boot process.

Conclusion: Use /etc/rc.local to Run Processes at Startup in Linux

Classic startup scripts in /etc/init.d and /etc/rc*.d are appropriate for many daemons and some more complicated user processes that must either start before a system process or be cleaned up during shutdown. However, /etc/rc.local is preferred for all other cases. It is a simple bash script you can edit as root on your machine.

Austin is a software engineer working on askR.com, a social recommendations site.

View his personal website.

Looking for exam help? Subscribe for testking 642-426 online training and get certified testking 1z0-051 study material including testking 642-566 Q &A for practice and pass the real test on first try.

Tags: , , ,

What Is Ubuntu?

What Is Ubuntu?

By Roharme D

Ubuntu is an easy version of Linux. It is not windows,but it is almost user friendly like windows. No all applications have graphical interface. Many applications force users to use commands to run them.Commands are mandatory to work with Linux and Ubuntu is not an exception.

Useful Commands:

* apt-get – Call Advanced Packaging Tool.

* clear – Clears terminal screen

* cat [filename] – Opens the file in terminal

* cat > [filename] – Createsa file with name mentioned

* chmod – Change the mode of a file to read, write, execute, extract etc.

* gedit – Opens gnome editor

* gksudo [program name] – Open graphic interface of an application with administrator

* install – Install a package or a component

* pon – Trigger a dsl-connection

* poff – Turn of a dsl-connection

* plog -PPPOE Log file.

* sudo -To become an administration for that particular transaction / terminal session alone.

* privileges.

* synaptic – Open package installer

* vi – Opens VI editor

Installing a software:

Ubuntu does not support direct executable files. You will either be provided with a compiled object that can be installed as such or the complete source code itself. In case of source code, it must be compiled first to proceed with the installation. There is no fixed way to compile the code. It depends upon the language in which the software has been written.

Fully compiled software will have standard extensions which Ubuntu understands by their extension.Some standard file type are

*.run – These files types must be executed with shell command as

* sh.run

*.deb – Deb is the abbreviated form of Debian packages. These packages can be installed right away by double clicking.It opens itself in package installer.

*.bin – These are standard binary files. They might be locked sometimes. They must be provided privileges before executing. The privileges can be changed by the command chmod with the switch +x.To install the software, use the command./[FILENAME].bin (note the dot in the beginning)

There are many other ways of installing a software.

Synaptic Manager:

This is a built-in Ubuntu installer. Ubuntu, keeps track of many useful and popular packages. They are indexed in the synaptic manager. You can install the software using the synaptic manager, if the software is listed in it.

To start synaptic manager, use the command sudo synaptic

Application Package Tool:

APT is one of the typical features of Ubuntu. There are plenty of software and utilities that can directly be installed in your system without having a downloaded soft copy. Just naming the package would suffice. Some famous package that can be installed with APT are

sudo apt-get install sun-java6-sdk sudo apt-get install xmms sudo apt-get install vlc sudo apt-get install mvn sudo apt-get install ant sudo apt-get install svn

Almost all applications can be opened using a command line. Command line version of software are faster than graphic interface as they occupy less memory.This could be a handy guide for beginners. But this is just a piece of Ubuntu. There are many things are there to be learnt to play with Ubuntu.

Tags: , , , , , , , ,

How to Configure SAMBA on a Linux Server
By Chris Ondo

Step By step guide to configuring SAMBA on a LINUX server.

This is for network administrators with experience configuring and administrating LINUX servers that want to know how to configure a SAMBA file server the right way step by step.

samba-logoIn this step by step tutorial I am going to show you how to make a shared folder on a linux server and share it so users on Microsoft windows workstations can access it on a local – internal network.

In this tutorial I am going to make the folder called “shared folder” and allow everybody access to the folder and printer networked to the Linux server.

This is a basic how to guide for configuring a samba workgroup file server.
I will cover how to build and configure a samba PDC – Primary domain controller in another tutorial for more experienced network administrators.

Open the samba configuration file using a unix text editor.
I like NANO since it is very easy to use.
Below are the commands I used to perform this task.

[root@localhost ~]# cd /etc
[root@localhost etc]# cd samba
[root@localhost samba]# nano smb.conf

Ok now we are in the smb.conf file
Now delete all the text in the configuration file.
Now copy and paste the below text…after that is done hit the “control and X buttons on your keyboard to exit out of the NANO text editor.
Then hit the Y button and last hit the ENTER button.
Now we are back to the command prompt and our samba configuration file is edited and saved.

workgroup = workgroup
server string = My Linux File Server
hosts allow = 192.168. 127.
log file = /var/log/samba/%m.log
security = user
netbios name = SAMBA SERVER
encrypt passwords = yes
smb passwd file = /etc/samba/smbpasswd
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

[shared folder]
comment = My Home Directory
browseable = yes
writable = yes
public = yes
read only = no

path = /var/spool/samba
public = yes
guest ok = yes
printable = yes
browseable = yes
writable = yes
read only = no

We have to create a user acct on the Linux server itself then we will create a samba user on top of the Linux user acct.

[root@localhost ~]# useradd chris
[root@localhost ~]# passwd chris
Changing password for user chris.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@localhost ~]# smbpasswd -a chris
New SMB password:
Retype new SMB password:
getsmbfilepwent: malformed password entry (no :)
mod_smbfilepwd_entry: malformed password entry (no :)
[root@localhost ~]#

We have to start the SAMBA service.
It may already be started or it may not…so let’s check and see.

[root@localhost ~]# service smb status
smbd is stopped
nmbd is stopped
[root@localhost ~]#

The samba service is not running so let’s start it up

[root@localhost ~]# service smb start
smbd (pid 4267 4266) is running…
nmbd (pid 4271) is running…
[root@localhost ~]#

Now let’s verify the service is running

[root@localhost ~]# service smb status
smbd (pid 4267 4266) is running…
nmbd (pid 4271) is running…
[root@localhost ~]#

reboot your windows XP workstations then go to network “my network places” then go to “workgroup computers”.
You will see a computer there called “My Linux File Server”.
You can manually map a local drive letter to this folder or write a logon script the same as you would connecting to a Microsoft file server – shared folder.
Double click on that computer and you will be prompted for a user name and password.
Use the user name and password you choose in step #2
Now you will see a folder called “shared folder” You can copy and paste data to this folder just like it were a windows file server.

Chris Ondo – Central Florida Computer Engineering


Tags: , , ,

Linux Terminal Control Sequences
By Bernard Peh

nokia5320_internet_cabledata9Linux terminals share alot in common with their primitive ancestors such as vt100 like consoles. These early devices is capable of sending sequences that signaled events outside of the normal flow of typed characters, such as escape, tab, linefeed…etc. Linux uses CTRL key to send out these out of band signals. This article summarises many of the commonly used control sequences that are used in all Linux terminals.


This is the most commonly used sequence. In the bash shell, CTRL-C will terminate any currently running process and return you to the bash prompt. For example, if you accidentally run a command that does not stop, use CTRL-C to cancel the command.


Many Unix commands read their input directly from the keyboard. An example is the WC command. WC counts the number of lines, words and characters that a user types in from the keyboard. So if you tpye WC at the command prompt, the command will wait for your input till you use CTRL-D to signal the end of transmission.


CTRL-Z means to suspend a program. For example, you are working with a command and you want to stop it temporary as it is taking too long. To do that, you can use CTRL-Z. You can later restore back the command using the fg command.


If you have messed up a certain command and you want to start all over, instead of using backspace, you can use CTRL-U. CTRL-U resets the current line.


Instead of using the backspace key, you can use CTRL-H to function the same way. Unless the backspace key is malfunctioned or mapped wrongly, this sequence serves very little purpose.


If your screen is too cluttered with unwanted information, you can clear the screen using CTRL-L.


Freeze your screen. This is a good command to use if you decide to go for a coffee break and do not want any process to run till you are back.


This sequence is exactly the opposite to CTRL-S. If you have freezed the screen before, you use this command to unfreeze it.


Functions the same way as the RETURN key.


Makes a terminal beep sound for fun and entertainment.

Control Sequences are important to all Linux / Unix users. Some sequences are important while some are useless today. It is worth memorising the first few sequences as described in this article.

Bernard Peh is a great passioner of web technologies and one of the co-founders of Sitecritic.net internet articles. He works with experienced web designers and developers everyday, developing and designing commercial websites. He specialises mainly in SEO and PHP work.

Tags: ,

Linux Commands Tutorials – Using the Ls Command With Examples of Options – A Hands-On Tutorial Help
By Clyde E. Boom

This Linux command tutorial shows you several examples of how to run the Linux ls command using popular, commonly used command options.

All of the Linux command examples shown below have been designed to work with all Linux distributions (versions).

So, if you run all of the Linux commands shown below yourself, you’ll have a mini Linux command tutorial.

Try it – it’s a great way to get Linux training!

The Linux ls Command

The Linux ls (list) command is a very popular Linux command that is used to show a listing of directories and files.

Linux ls Command Tutorial – Showing Examples of Using ls Command Options

Run the CD (change directory) command below to change into the etc directory (folder) so we have lots of directories and files for the ls command examples below.

]$ CD /etc

Run the ls command without any options.

]$ ls

This shows a listing of all directories and files (items) in the current directory, which is the etc directory. There are a lot of items and only the end of the listing appears. You can’t see the top of the listing because it has scrolled off the screen.

So, we will use the | (vertical bar – above the Enter key on many keyboards) to “pipe” the output of the ls command to the less command – and then see some options of the ls command.

Linux Tips: To type the | (vertical bar) on most keyboards, hold down the shift key and press the (backslash) key.

Linux Tips: The less command is used to pause the output of a command after the first “screenful”, so the output doesn’t scroll off the screen. The less command is a Linux command, and not an option of the ls command.

]$ ls | less

Now, because you piped the output of the ls command to the less command, you can use the Up Arrow, Down Arrow and Page Up and Page Down keys to scroll through the output of the ls command.

Press the Down Arrow key a few times; then the Up Arrow key and then Page Up and Page Down. A nice way to view the files in the Linux file system!

Notice that just the item (directory and file) names appear. You don’t see any other information, such as the size and date.

Press the letter “q” (without the quotes) to quit out of the less command. Do this after running each of the command examples below.

Now run the ls command with the -l (for long) option to get a “long” and more detailed listing of the items in the etc directory.

]$ ls -l | less

Now you get lots more info on each item! The size (in bytes) of the item appears at the left of the date. When a “d” appears at the far left of an item, this indicates that the item is a directory (folder).

Try scrolling down and then scrolling up.

The ls command below uses both the -l and -S options. The -S option causes the items to be sorted by size, with the largest item at the top.

Linux Tips: Linux commands are case sensitive, so when you see an upper case “S”, be sure to type in a capital “S” (without the quotes).

]$ ls -lS | less

Press the Page Down key until you get to the bottom of the listing.
A Practical Linux ls Command Example – Listing Linux Text Configuration Files

Now let’s say you need to look at some of the system configuration settings in a Linux text file. You know the file is in the current directory (etc) and that the file ends in “.conf”, but you can’t remember the full name of the file.

To see all possible file names, you use a Linux “pattern” of “*.conf” . This pattern uses the * (asterisk) wildcard character to show all files that end in “.conf”.

]$ ls -l *.conf | less

Now you see the Linux text file you need and can check the settings in it.

Quit out of the less command.

The exit command is used to close a terminal emulation window and end a Linux bash shell “session”.

]$ exit

Beyond This “Linux Commands Tutorials” Article
The Linux ls command is one of the most popular and commonly used Linux commands. There are lots of uses for the ls command and many other useful ls command options.

As part of your Linux training, you also need to learn how to use the ls command to: get a listing of “hidden” files, get a listing using an absolute path and relative path, get listings using several different “patterns” (with wildcard characters), and list directories and files recursively.

Now, imagine watching a clearly narrated Linux video tutorial that not only shows all of the examples above, but also shows you the full output of each command – you get to learn Linux live!

Then imagine pausing the Linux video after each example and trying the commands yourself – an excellent way to get Linux training!

And now I would like to offer you free access to my Linux Commands Training Mini-Course, a 7 Lesson, Daily Mini-Course, including the free Linux Commands ebook and Linux audio podcasts – showing you how to get started learning how to use Linux commands.

You can get your instant access at: http://www.LinuxCommandsTrainingCourse.com

From Clyde Boom – The Easy Linux Training Guy – Easy, self-paced Linux training – In Plain English!

« Previous posts Next posts » Back to top