1. Which command combination creates and removes directories?
mkdir creates a new directory, while rmdir removes an empty one. For non-empty directories, you can use rm -r to delete them recursively.
mkdir newfolder rmdir newfolder
Get the Preplance app for a seamless learning experience. Practice offline, get daily streaks, and stay ahead with real-time interview updates.
Get it on
Google Play
4.9/5 Rating on Store
Wipro · Linux & Shell Scripting
Practice Linux & Shell Scripting questions specifically asked in Wipro interviews – ideal for online test preparation, technical rounds and final HR discussions.
Questions
20
Tagged for this company + subject
Company
Wipro
View company-wise questions
Subject
Linux & Shell Scripting
Explore topic-wise practice
Go through each question and its explanation. Use this page for targeted revision just before your Wipro Linux & Shell Scripting round.
mkdir creates a new directory, while rmdir removes an empty one. For non-empty directories, you can use rm -r to delete them recursively.
mkdir newfolder rmdir newfolder
For complete preparation, combine this company + subject page with full company-wise practice and subject-wise practice. You can also explore other companies and topics from the links below.
You can execute a script by running bash scriptname.sh, which starts a new shell. Alternatively, make it executable using chmod +x scriptname.sh and run it directly with ./scriptname.sh from the terminal.
chmod +x deploy.sh ./deploy.sh
The kill command sends a signal to a process to terminate it. Use kill -9 for forceful termination when normal kill fails.
kill -9 1234
You can view your previous commands with the history command. Each command is numbered and can be re-run using !number. Aliases let you create shortcuts for long commands using the alias keyword, improving productivity during repeated tasks.
alias ll='ls -alF' unalias ll
useradd creates a new user account on the system. It can also specify home directories, groups, and shells. The adduser command is a user-friendly wrapper available in some Linux distributions.
sudo useradd -m -s /bin/bash devuser
You can add a user to a group using the usermod command with the -aG option. This ensures the user gets additional group permissions without removing existing ones. It’s common when granting sudo or docker access.
sudo usermod -aG sudo vipul
In Bash, conditions are enclosed in square brackets with spaces around them. After then, you write the commands to execute if the condition is true, followed by fi to end the block.
if [ $age -gt 18 ]; then echo 'Adult' fi
You can check the exit status of each command using $? and use if conditions to act on failures. Adding set -e at the top stops script execution immediately when a command fails, ensuring predictable automation.
set -e cp data.txt /backup/ || echo 'Backup failed'
ping sends ICMP echo requests to a host to check if it’s reachable and measures round-trip latency. It’s one of the first commands used for basic network troubleshooting.
ping google.com
Use grep to search for keywords like ERROR or WARNING in log files. Combine with tail -f for real-time tracking during deployments or troubleshooting.
grep 'ERROR' /var/log/app.log | tail -n 20
systemctl is the primary command to manage services on systems using systemd. You can start, stop, enable, or check the status of services using it.
sudo systemctl start nginx
Unit files define how systemd manages services, sockets, targets, and timers. They are stored under /etc/systemd/system for custom services and /lib/systemd/system for system-managed ones.
/etc/systemd/system/myapp.service
UFW (Uncomplicated Firewall) is a frontend for iptables that simplifies firewall configuration. The command ufw enable activates it with the default rules.
sudo ufw enable
scp (secure copy) transfers files between hosts securely using the SSH protocol. It’s simple and encrypted, making it ideal for server-to-server data transfers.
scp file.txt user@server:/tmp/
umount safely detaches a mounted filesystem. Always close open files and change directories before unmounting to avoid data loss.
sudo umount /mnt/data
rsync transfers files locally or between remote systems efficiently. It copies only changed parts, making it ideal for backups and incremental syncs.
rsync -av /data /backup/
Use du and find commands to locate large files, then manually delete or archive them. You can automate this cleanup using a shell script scheduled via cron for periodic maintenance.
find / -type f -size +500M -exec ls -lh {} \;Redirect both standard output and error streams to a log file in the cron entry. This ensures any issues during execution are captured for analysis.
0 2 * * * /scripts/backup.sh > /var/log/backup.log 2>&1
reload signals the service to re-read configuration files without a full restart. This reduces downtime, making it ideal for web or database servers where uptime is critical.
sudo systemctl reload nginx
Appending an ampersand (&) at the end of a command executes it in the background. This frees the terminal and allows multiple commands to run simultaneously.
sh long_script.sh &