punctuation. Start the filename with a letter or digit (unless you want to specify a hidden file), and do not include spaces.
Although it makes command-line file manipulation more awkward, more and more users are adding spaces to photo and music filenames.
? Use the single form of words instead of the plural (
? Filename extensions (such as
4.3.1.5. Listing the contents of directories
The
$ ls
4Suite crontab hosts libuser.conf nxserver
a2ps.cfg cron.weekly hosts.allow lisarc oaf
...(Lines snipped)...
You can specify an alternate directory or file pattern as an argument:
$ ls
bin etc lost+found mnt proc sbin sys usr
boot home media net ptal selinux tftpboot var
dev lib misc opt root srv tmp
$ ls -d
a2ps.cfg alsa ant.conf audit.rules
a2ps-site.cfg alternatives ant.d auto.master
acpi amanda asound.state auto.misc
adjtime amandates atalk auto.net
alchemist amd.conf at.deny auto.smb
aliases amd.net atmsigd.conf
aliases.db anacrontab auditd.conf
By default, filenames starting with a dot ( . ) are not shown. This provides a convenient way to store information such as a program configuration in a file without constantly seeing the filename in directory listings; you'll encounter many dot files and directories in your home directory. If you wish to see these 'hidden' files, add the -a (all) option:
$ ls -a
$ ls -l
-rw------- 1 chris chris 3962 Aug 29 02:57 a2script
-rwx------ 1 chris chris 17001 Aug 29 02:57 ab1
-rw------- 1 chris chris 2094 Aug 29 02:57 ab1.c
-rwx------ 1 chris chris 884 Aug 29 02:57 perl1
-rw------- 1 chris chris 884 Aug 29 02:57 perl1.bck
-rwx------ 1 chris chris 55 Aug 29 02:57 perl2
-rw------- 1 chris chris 55 Aug 29 02:57 perl2.bck
-rwx------ 1 chris chris 11704 Aug 29 02:57 pointer1
-rw------- 1 chris chris 228 Aug 29 02:57 pointer1.c
-rwx------ 1 chris chris 12974 Aug 29 02:57 pp1
-rw------- 1 chris chris 2294 Aug 29 02:57 pp1.c
ls -l is so frequently used that Fedora has a predefined
You can also sort by file size (from largest to smallest) using -S :
$ ls -S -l
-rwx------ 1 chris chris 17001 Aug 29 02:57 ab1
-rwx------ 1 chris chris 12974 Aug 29 02:57 pp1
-rwx------ 1 chris chris 11704 Aug 29 02:57 pointer1
-rw------- 1 chris chris 3962 Aug 29 02:57 a2script
-rw------- 1 chris chris 2294 Aug 29 02:57 pp1.c
-rw------- 1 chris chris 2094 Aug 29 02:57 ab1.c
-rwx------ 1 chris chris 884 Aug 29 02:57 perl1
-rw------- 1 chris chris 884 Aug 29 02:57 perl1.bck
-rw------- 1 chris chris 228 Aug 29 02:57 pointer1.c
-rwx------ 1 chris chris 55 Aug 29 02:57 perl2
-rw------- 1 chris chris 55 Aug 29 02:57 perl2.bck
The first character on each line is the file type: - for plain files, d for directories, and l for symbolic links.
There are dozens of options to the
4.3.1.6. Displaying and changing the current working directory
To print the name of the current working directory, use the
$ pwd
/home/chris
To change the directory, use the cd (change-directory) command.
To change to the
$ cd
To change to the