0% found this document useful (0 votes)
96 views

Unix Command

The ls command lists files and provides information about them. Common switches like -al provide a long listing with details like permissions, size, and date. The ls command can also take a filename to get information about a specific file. The uname -a command shows information about the current machine and operating system. The pwd command prints the working directory. The clear command clears the screen. The touch command creates a new empty file or updates the timestamp of an existing file. Files with spaces cannot be created, so underscores or capital letters should be used to separate words in filenames. The mkdir command makes a new directory. The rmdir command removes an empty directory, while rm -rf can remove a non-empty directory. The rm command

Uploaded by

api-3763657
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
96 views

Unix Command

The ls command lists files and provides information about them. Common switches like -al provide a long listing with details like permissions, size, and date. The ls command can also take a filename to get information about a specific file. The uname -a command shows information about the current machine and operating system. The pwd command prints the working directory. The clear command clears the screen. The touch command creates a new empty file or updates the timestamp of an existing file. Files with spaces cannot be created, so underscores or capital letters should be used to separate words in filenames. The mkdir command makes a new directory. The rmdir command removes an empty directory, while rm -rf can remove a non-empty directory. The rm command

Uploaded by

api-3763657
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

Lists files. The equivalent of "dir" in DOS.

Common switches are -al which will list all


files with a long description, including their permissions, size, and datestamp. You can
also type in ls -al followed by a specific filename to learn information about that specific
file. This is helpful if you have many files within a directory and you only want
information on one of them. You can even use wildcards. For example, ls *.html show
only files with extension .html
uname -a Show info about current machine and operative system
Print Working Directory. Wonder which directory you're currently in? This reveals full
pwd
path.
clear clear the screen
touch filename. If filename doesn't exist it gets created (0 byte). If filename already
exists, touch alters its timestamp to the current time. Please note, in UNIX we can not
touch easily name files with spaces in them, so words should use underscores or a capital letter
to separate them. For example, touch my file will not work. You must write either touch
myFile or touch my_file . This applies to creating directories as well.
mkdir makes a directory. You can put files in a directory :)
rmdir removes an empty directory. If it is not empty, you can use rm -rf instead.
removes files. You can use it with wildcards too. For example rm -f *.html will remove
rm all html files in the directory. You can use it to remove a directory with an -rf switch.
However, this is not the ideal way to remove directories.
cp originalFile newFile Creates a copy of the first file having the name of the second. If
the paths are not specificied, then cp assumes you mean the current working directory.
You can also copy a file to another location. For example,
cp
cp OriginalFile /home/someDirectory/newFile will copy a file from the current
directory to another directory with "NewFile" as it's name. If no name is specified, and
you are copying the file to another directory, then the original filename will be used.

You might also like