This is an in-depth explanation for use with the AIX Basics Certification Guide.
- Determine current working directory → pwd
- Change between directories → cd
- List the contents of a directory → ls [-l][-a]
- Understand absolute and relative paths → /etc/passwd ./passwd ~/files
- Determine file system type → lsvg -l rootvg, lsfs -v jfs,
- Rename, copy, move and delete files → mv, cp, rm
- Create, rename and delete directories → mkdir, mv -r, cp -r, rm -r
- Locate files and directories (find command) find [directory] -name [name]
- Change permissions associated with a file or directory → chown, chmod
- Understand symbolic and hard links → ln (hard), ln -s (soft). Hard: only files and updates upon moves, Soft: between FS and can link directories. If source moved link broken
- Show the contents of a file (pg, more, cat)
Determine the Current Working Directory
the “pwd” command will give you the present working directory. There is an environment variable called “PWD” which actually changes every time you change the current directory, and the “pwd” simply echoes this value
Change between directories
In order to navigate to different directories, you can issue the “cd” command. This command can be used for both relative and absolute navigation. If you are in your home folder, issue an “ls -l” command. Any files with a “d” as the first letter in the first column is a directory. To navigate to this directory “cd directory“. To navigate back to your home directory, you can issue one of the following:
“cd ..” — return to the directory one level up
“cd /home/user” — return to a specific directory
“cd ~” — return to home directory of current user
List the contents of a directory
The “ls” command will output the contents of the present working directory. To list outputs of a specific directory, issue “ls directory”. To list further details about the contents, issue “ls -l”. This will return the following attributes:
- first letter -> If a “d” this is a directory, if a “-” it is a file
- following 9 letters -> states the read/write/execute attributes in that order for user,group,other
- next column states the amount of contents in the directory (1 if a file)
- next 2 columns tell you the owner’s username and group
- next column is the size (defaults to 4096 for directories)
- next is the date and time
- finally the file name
You can also manipulate the output by piping it to the following tools:
- “ls | more” -> contents exceeds one page, this helps to increment through output
- “ls | sort” -> sort output based on name
Understand absolute and relative paths
As mentioned previously, there can be both absolute and relative references. An absolute path refers to a specific location on the server. Relative refers to a location relative to your current location. An absolute path will always begin with the root folder “/”, and a relative path will not.
Relative paths are beneficial when dealing with large numbers of sub directories, and when navigating around your current location. To go forward in relative paths you simply begin with the next sub directory you would like to navigate to. To go backwards you must begin with “..” which refers to the parent directory. Relative paths include the following:
“..” -> parent directory
“../different_folder” -> a separate folder in the parent directory
“../..” -> two parent directories back
Determine file system type
Different file systems can be different types. Commonly, file systems are of type jfs, jfs2, paging just to name a few. When viewing the contents of a volume group, “lsvg -l rootvg” there is a column specifying the type. The “lsfs” command will also inform you of the type of each file system, as it will list all file systems (as opposed to lsvg which lists the contents of a specific volume group”
You can also issue the following commands to list the file systems that are of a specified type:
“lsfs -v type” -> list all file systems of whichever type
“lsjfs” -> list jfs file systems
“lsjfs2″ -> list jfs2 file systems
Rename, copy, move and delete files
Issue the following commands:
“mv source destination” -> The move command can be used to both move a file to a new location (cut and paste) or to rename a file. Example “mv file1 file2″ to rename a file, “mv /dest1/file /dest2/file” to move a file from dest1 folder to dest2.
“cp source newfile” -> The copy command can be used to make a copy of a file and place it in a specified location. “cp file file1″ will result in two files with the exact same contents saved with different names. “cp file /new/dest/file” will copy a file to a new destination and keep the same name.
“rm file” -> remove a file permanently. And I mean permanently, usually without warning
Create, rename and delete directories
“mkdir directory_name” -> make a directory in the current directory
“mkdir /home/user/newdir” -> make a directory using an absolute path
“mv -r directory newdir” -> rename new directory and keep contents under new directory name
“rm -r directory” -> remove a folder and all of its contents. Again, permanently
Locate files and directories (find command)
An example of the “find” command is below. The find command is a great way to recursively list the contents of a specific folder. This means that you will get the contents of the specified directory as well as all directories inside of it.
“find directory -name name -type type”
“find directory” -> the directory you would like to search within
“-name name” -> the name of the files you would like to find. Example “-name .sh” to find all shell scripts
“-type type” -> the type of file you would like to return. “d” directory, “f” file, “l” symbolic link…
Change permissions associated with a file or directory
As seen earlier with the “ls -l” command, one can see the permissions of a file/directory and the owner. In the event that you need to change these files, you will need to issue one of these two commands:
“chown user:group file” -> change the owner of a specified file
“chmod u+rwx file” -> add read, write and execute attributes for the owner
“chmod g-w file” -> remove write access to the file’s group
“chmod o-rwx” -> remove read, write and execute access for everyone not a part of the owner group
Understand symbolic and hard links
To simplify things, you are able to make links in AIX to allow you to access files from different locations, much like short cuts. There are two distinct types of links, symbolic (soft) and hard links.
A hard link is restricted to files (not directories), cannot cross file system boundaries and if you move the source file, the link is updated. This is not the same for symbolic links. A symbolic link can be a directory or a file, and is used between file systems. If the source is moved however, the link will break, requiring the creator to update the link.
To create a soft link “ln -s source newfile“. To view a link, perform an “ls -l” in a directory. A link will have “filename -> link source”
Show the contents of a file
You can view the contents of a file in many ways. A list of only a few is below:
“more” -> display the contents one page at a time. ”Space” to go forward, “b” to go back
“pg” -> similar to “more” however this includes a prompt for further navigation abilities
“cat” -> display the all contents



[...] This is an in-depth explanation for use with the AIX Basics Certification Guide. (Continued from here) [...]
[...] what I followed and I updated most steps with a snipit of info to point you in the right direction Understand and manipulate AIX filesystems [...]