The ls command is used to view the contents of a directory.
There are variations you can use with the ls command:
- ls -R will list all the files in the sub-directories as well
- ls -a will show the hidden files
- ls -al will list the files and directories with detailed information like the permissions, size, owner, etc.
cd command is used for change directory
Let’s say you’re in /home/username/Documents and you want to go to Photo, a subdirectory of Documents. To do so, simply type the following command: cd Photo.
- cd .. to move one directory up
- cd to go straight to the home folder
- cd- to move to your previous directory
Use the PWD command to find out the path of the current working directory.
An example of an absolute path is /home/username.
cat It is used to list the contents of a file on the standard output. To run this command, type cat followed by the file’s name and its extension. For instance: cat file.tcl.
- to convert a file to upper or lower case use, cat filename | tr a-z A-Z >output.tcl
cp command to copy files from the current directory to a different directory.
mv command is to move files,
It can also be used to rename files.
To rename files, the Linux command is mv oldname.tcl newname.tcl
If you need to delete a directory, use the rmdir command.
rmdir only allows you to delete empty directories.
Use mkdir command to make a new directory
To generate a new directory inside another directory, use this Linux basic command mkdir Music/tclfile
The top command will display a list of running processes and how much CPU each process uses.
It’s very useful to monitor system resource usage, especially knowing which process needs to be terminated because it consumes too many resources.
The touch command allows you to create a blank new file through the Linux command line. As an example, enter touch /home/username/Documents/Web.html to create an HTML file entitled Web under the Documents directory.
To search for a file that contains two or more words, use an asterisk (*). For example, locate -i
Using find also searches for files and directories. The difference is, you use the find command to locate files within a given directory.
- To find files in the current directory use, find . -name notes.tcl
- To look for directories use, / -type d -name notes. tcl
Basic Linux command that is undoubtedly helpful for everyday use is grep. It lets you search through all the text in a given file.
grep black notepad.tcl will search for the word black in the notepad file. Lines that contain the searched word will be displayed fully.
SuperUser Do: this command enables you to perform tasks that require administrative or root permissions.
Use df command to get a report on the system’s disk space usage, If you want to see the report in megabytes,
type df -m.
echo command is used to move some data into a file.
For example, if you want to add the text, “Hello, my name is Dipak” into a file called name.tcl, you would type echo Hello, my name is Dipak >> name.tcl
The head command is used to view the first lines of any text file. if you only want to show the first five lines, type head -n 5 filename.tcl.
tail command will display the last ten lines of a text file. For example, tail -n filename.tcl.
Short for difference, the diff command compares the contents of two files line by line. After analyzing the files, it will output the lines that do not match. Programmers often use this command when they need to make program alterations instead of rewriting the entire source code.
The tar command is the most used command to archive multiple files into a tarball . This is the common Linux file format that is similar to zip format, with compression being optional.
chmod is another Linux command, used to change the read, write, and execute permissions of files and directories.
The chown command enables you to change or transfer the ownership of a file to the specified username.
jobs command will display all current jobs along with their statuses. A job is basically a process that is started by the shell.
If you have an unresponsive program, you can terminate it manually by using the kill command. It will send a certain signal to the misbehaving app and instructs the app to terminate itself.
Use the ping command to check your connectivity status to a server. For example, by simply entering ping google.com, the command will check whether you’re able to connect to Google and also measure the response time.
You can even download files from the internet with the help of the wget command.
This uname command, short for Unix Name, will print detailed information about your Linux system like the machine name, kernel, and so on.
The rm command is used to delete directories and the contents within them. If you only want to delete the directory
This will delete everything and there is no undo.
history command is particularly useful if you want to review the commands you’ve entered before.
If you want to check how much space a file or a directory takes, the du (Disk Usage).If you want to see it in bytes, kilobytes, and megabytes, add the -h argument to the command line..
|Analog Layout Design Interview Questions
|Memory Design Interview Questions
|Physical Design Interview Questions
|Verilog Interview Questions
|Digital Design Interview Questions
|STA Interview Questions