hi,
I am trying to take unix administration and shell scripting courses this summer. I have done 2 courses of C++ and a course of java. However i have never learned C. Anyone please give me some opinion if learning C is necessary for Unix. Since C++ is inherited from C, are they pretty much similar? Is unix scripting harder or easier comparing C++?

Dani AI

Generated

A compact, practical prep guide that builds on what and started. The goal is to make the upcoming Unix administration and shell-scripting course easier in practice, not to restate generalities. Focus on concrete skills that pay off during labs and on the job.

For shell work: learn POSIX shell basics plus common Bash extensions. Key areas are quoting and word-splitting, parameter expansion, command substitution, redirection and piping, exit codes, and simple functions. Get comfortable with the text-toolchain: grep, sed, awk, find, xargs, cut, sort, uniq. Make small, testable scripts and use set -x for tracing and bash -n or shellcheck to lint. Note: set -euo pipefail is handy but has gotchas; test behavior on edge cases before relying on it.

For C-like skills that help in a Unix context: focus on pointers and arrays, manual memory management, strings, file descriptors vs stdio, and basic process control (fork/exec semantics) and signals. Learn the compile-debug cycle: gcc -Wall -Wextra -g, use sanitizers (-fsanitize=address,undefined) and tools like gdb, strace and Valgrind (or ASan). Practice reading a small C utility and rebuilding it; that familiarity makes it easier to understand service behavior and logs.

A short hands-on plan: write a reliable backup script (find + tar + safe quoting), build a small C program that opens a file and forks to run another command, then intentionally break the script/program and debug with set -x, gdb and strace. If scripts grow beyond a few hundred lines, prefer a higher-level language (Python) or refactor into modular tools. Watch for common pitfalls: unquoted variables in shell and unchecked returns or buffer overflows in C.

Recommended Answers

All 2 Replies

C is easy to pick up if you know c++

just forget everything you know about OOP

and yeah, most opensource code, e.g linux kernel is written in C

hi,
I am trying to take unix administration and shell scripting courses this summer. I have done 2 courses of C++ and a course of java. However i have never learned C. Anyone please give me some opinion if learning C is necessary for Unix. Since C++ is inherited from C, are they pretty much similar? Is unix scripting harder or easier comparing C++?

C is a definite MUST for serious UNIX/Linux development (kernel modules or small-footprint daemons), I concur that it should be easier to pick up C from C++ than the other way around.

As to your question of scripting being easier or harder, that's a tough one. In your class experience it might well be easier because most of the exercises are simple cases. Once you go from several dozen to several hundred lines of shell script or PERL (the two likely suspects for any course in admin/scripting) things can get pretty hairy, especially if you didn't write it in the first place.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.