x
Loading
 Loading
Hello, Guest | Login | Register

The ls, du, and sort Commands, How to Get the LILO Prompt Back

The ls command allows file listings to be displayed in a variety of ways. Commonly used options are -a (does not hide dot.files), -l (long/verbose listing format, includes file attributes and sizes), and -color (displays files/directories in different colors depending on attributes). Type man ls to get a more complete listing of options.

1

How can I change the way files are displayed by default in a directory listing?

The ls command allows file listings to be displayed in a variety of ways. Commonly used options are -a (does not hide dot.files), -l (long/verbose listing format, includes file attributes and sizes), and -color (displays files/directories in different colors depending on attributes). Type man ls to get a more complete listing of options.

One of the easiest ways that you can set default attributes for ls is to set up a shell alias. I’ll use bash for the example here. Try adding the following line to the file .bashrc in your home directory.

alias ls = ls -a -color 

You can also type this command in the current shell to make the alias effective immediately (until you close your shell).

The lines in the .bashrc file are run every time you begin an interactive shell, ensuring that this alias is reset automatically.

2

I have a Perl script that will not run. Executing it results in a bash: ./script.pl: No such file or directory error. The file exists and is executable. Why won’t it work?

Executable scripts may use the first line of the script to tell the shell which pro-gram to run in order…

Please log in to view this content.

Not Yet a Member?

Register with LinuxMagazine.com and get free access to the entire archive, including:

  • Hands-on Content
  • White Papers
  • Community Features
  • And more.
Already a Member?
Log in!
Username

Password

Remember me

Forgotten your password?
Forgotten your username?
Read More
  1. KDE 4.4: Does It Work Yet?
  2. Writing Custom Nagios Plugins with Python
  3. Power Up Linux GUI Apps
  4. Tweeting from the Command Line with Twyt
  5. When Memory Serves You: Using ramfs and tmpfs
Follow Linux Magazine
Rackspace